All of lore.kernel.org
 help / color / mirror / Atom feed
* [patch 00/11] Cleanup unload_nls() calls
@ 2009-08-14 12:42 Thomas Gleixner
  2009-08-14 12:42 ` [patch 01/11] fs: Make unload_nls() NULL pointer safe Thomas Gleixner
                   ` (11 more replies)
  0 siblings, 12 replies; 16+ messages in thread
From: Thomas Gleixner @ 2009-08-14 12:42 UTC (permalink / raw)
  To: LKML; +Cc: Al Viro, Christoph Hellwig

While looking through the BKL call sites in fs/* I noticed that most
callsites of unload_nls() do 

	  if (nls) 
	     	   unload_nls(nls);

The patch series moves the NULL pointer check into unload_nls() and
cleans up the various users.

Thanks,

	tglx
---
befs/linuxvfs.c |    7 +------
cifs/cifsfs.c   |    3 +--
fat/inode.c     |   16 ++++------------
hfs/mdb.c       |    6 ++----
hfsplus/super.c |    6 ++----
isofs/inode.c   |    8 ++------
jfs/super.c     |    9 +++------
ncpfs/inode.c   |   12 ++----------
ncpfs/ioctl.c   |    6 ++----
nls/nls_base.c  |    3 ++-
ntfs/super.c    |   10 ++++------
smbfs/inode.c   |   10 ++--------
12 files changed, 27 insertions(+), 69 deletions(-)
             



^ permalink raw reply	[flat|nested] 16+ messages in thread

* [patch 01/11] fs: Make unload_nls() NULL pointer safe
  2009-08-14 12:42 [patch 00/11] Cleanup unload_nls() calls Thomas Gleixner
@ 2009-08-14 12:42 ` Thomas Gleixner
  2009-08-14 12:42 ` [patch 02/11] fat: cleanup fat_put_super() Thomas Gleixner
                   ` (10 subsequent siblings)
  11 siblings, 0 replies; 16+ messages in thread
From: Thomas Gleixner @ 2009-08-14 12:42 UTC (permalink / raw)
  To: LKML; +Cc: Al Viro, Christoph Hellwig

[-- Attachment #1: fs-make-unload-nls-null-pointer-safe.patch --]
[-- Type: text/plain, Size: 706 bytes --]

Most callsites of unload_nls() do 
     if (nls)
	   unload_nls(nls);

Check the pointer inside unload_nls() like we do in kfree() so we can
simplify the call sites.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
 fs/nls/nls_base.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Index: linux-2.6-tip/fs/nls/nls_base.c
===================================================================
--- linux-2.6-tip.orig/fs/nls/nls_base.c
+++ linux-2.6-tip/fs/nls/nls_base.c
@@ -270,7 +270,8 @@ struct nls_table *load_nls(char *charset
 
 void unload_nls(struct nls_table *nls)
 {
-	module_put(nls->owner);
+	if (nls)
+		module_put(nls->owner);
 }
 
 static const wchar_t charset2uni[256] = {



^ permalink raw reply	[flat|nested] 16+ messages in thread

* [patch 02/11] fat: cleanup fat_put_super()
  2009-08-14 12:42 [patch 00/11] Cleanup unload_nls() calls Thomas Gleixner
  2009-08-14 12:42 ` [patch 01/11] fs: Make unload_nls() NULL pointer safe Thomas Gleixner
@ 2009-08-14 12:42 ` Thomas Gleixner
  2009-08-14 13:12   ` OGAWA Hirofumi
  2009-08-14 12:42 ` [patch 03/11] befs: cleanup befs_put_super() Thomas Gleixner
                   ` (9 subsequent siblings)
  11 siblings, 1 reply; 16+ messages in thread
From: Thomas Gleixner @ 2009-08-14 12:42 UTC (permalink / raw)
  To: LKML; +Cc: Al Viro, Christoph Hellwig, OGAWA Hirofumi

[-- Attachment #1: fat-cleanup-nls-unload.patch --]
[-- Type: text/plain, Size: 1160 bytes --]

unload_nls() can be called with a NULL pointer now. Remove the pointer
checks and the NULLification of the pointers as the data structure
which contains the pointers is kfree'd right away.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
---
 fs/fat/inode.c |   16 ++++------------
 1 file changed, 4 insertions(+), 12 deletions(-)

Index: linux-2.6-tip/fs/fat/inode.c
===================================================================
--- linux-2.6-tip.orig/fs/fat/inode.c
+++ linux-2.6-tip/fs/fat/inode.c
@@ -470,19 +470,11 @@ static void fat_put_super(struct super_b
 
 	iput(sbi->fat_inode);
 
-	if (sbi->nls_disk) {
-		unload_nls(sbi->nls_disk);
-		sbi->nls_disk = NULL;
-		sbi->options.codepage = fat_default_codepage;
-	}
-	if (sbi->nls_io) {
-		unload_nls(sbi->nls_io);
-		sbi->nls_io = NULL;
-	}
-	if (sbi->options.iocharset != fat_default_iocharset) {
+	unload_nls(sbi->nls_disk);
+	unload_nls(sbi->nls_io);
+
+	if (sbi->options.iocharset != fat_default_iocharset)
 		kfree(sbi->options.iocharset);
-		sbi->options.iocharset = fat_default_iocharset;
-	}
 
 	sb->s_fs_info = NULL;
 	kfree(sbi);



^ permalink raw reply	[flat|nested] 16+ messages in thread

* [patch 03/11] befs: cleanup befs_put_super()
  2009-08-14 12:42 [patch 00/11] Cleanup unload_nls() calls Thomas Gleixner
  2009-08-14 12:42 ` [patch 01/11] fs: Make unload_nls() NULL pointer safe Thomas Gleixner
  2009-08-14 12:42 ` [patch 02/11] fat: cleanup fat_put_super() Thomas Gleixner
@ 2009-08-14 12:42 ` Thomas Gleixner
  2009-08-14 12:42 ` [patch 04/11] cifs: cleanup unload_nls() call Thomas Gleixner
                   ` (8 subsequent siblings)
  11 siblings, 0 replies; 16+ messages in thread
From: Thomas Gleixner @ 2009-08-14 12:42 UTC (permalink / raw)
  To: LKML; +Cc: Al Viro, Christoph Hellwig

[-- Attachment #1: befs-cleanup-nls-unload.patch --]
[-- Type: text/plain, Size: 846 bytes --]

unload_nls() can be called with a NULL pointer now. Remove the pointer
checks and the NULLification of the pointer as the data structure
which contains the pointer is kfree'd right away.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
 fs/befs/linuxvfs.c |    7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

Index: linux-2.6-tip/fs/befs/linuxvfs.c
===================================================================
--- linux-2.6-tip.orig/fs/befs/linuxvfs.c
+++ linux-2.6-tip/fs/befs/linuxvfs.c
@@ -737,12 +737,7 @@ befs_put_super(struct super_block *sb)
 {
 	kfree(BEFS_SB(sb)->mount_opts.iocharset);
 	BEFS_SB(sb)->mount_opts.iocharset = NULL;
-
-	if (BEFS_SB(sb)->nls) {
-		unload_nls(BEFS_SB(sb)->nls);
-		BEFS_SB(sb)->nls = NULL;
-	}
-
+	unload_nls(BEFS_SB(sb)->nls);
 	kfree(sb->s_fs_info);
 	sb->s_fs_info = NULL;
 }



^ permalink raw reply	[flat|nested] 16+ messages in thread

* [patch 04/11] cifs: cleanup unload_nls() call
  2009-08-14 12:42 [patch 00/11] Cleanup unload_nls() calls Thomas Gleixner
                   ` (2 preceding siblings ...)
  2009-08-14 12:42 ` [patch 03/11] befs: cleanup befs_put_super() Thomas Gleixner
@ 2009-08-14 12:42 ` Thomas Gleixner
  2009-08-14 12:42 ` [patch 05/11] hfs: clenaup unload_nls() calls Thomas Gleixner
                   ` (7 subsequent siblings)
  11 siblings, 0 replies; 16+ messages in thread
From: Thomas Gleixner @ 2009-08-14 12:42 UTC (permalink / raw)
  To: LKML; +Cc: Al Viro, Christoph Hellwig, Steve French

[-- Attachment #1: cifs-cleanup-nls-unload.patch --]
[-- Type: text/plain, Size: 650 bytes --]

unload_nls() can be called with a NULL pointer now. Remove the pointer
check.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Steve French <sfrench@us.ibm.com>
---
 fs/cifs/cifsfs.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Index: linux-2.6-tip/fs/cifs/cifsfs.c
===================================================================
--- linux-2.6-tip.orig/fs/cifs/cifsfs.c
+++ linux-2.6-tip/fs/cifs/cifsfs.c
@@ -185,8 +185,7 @@ out_mount_failed:
 			cifs_sb->mountdata = NULL;
 		}
 #endif
-		if (cifs_sb->local_nls)
-			unload_nls(cifs_sb->local_nls);
+		unload_nls(cifs_sb->local_nls);
 		kfree(cifs_sb);
 	}
 	return rc;



^ permalink raw reply	[flat|nested] 16+ messages in thread

* [patch 05/11] hfs: clenaup unload_nls() calls
  2009-08-14 12:42 [patch 00/11] Cleanup unload_nls() calls Thomas Gleixner
                   ` (3 preceding siblings ...)
  2009-08-14 12:42 ` [patch 04/11] cifs: cleanup unload_nls() call Thomas Gleixner
@ 2009-08-14 12:42 ` Thomas Gleixner
  2009-08-14 12:43 ` [patch 06/11] hfsplus: cleanup " Thomas Gleixner
                   ` (6 subsequent siblings)
  11 siblings, 0 replies; 16+ messages in thread
From: Thomas Gleixner @ 2009-08-14 12:42 UTC (permalink / raw)
  To: LKML; +Cc: Al Viro, Christoph Hellwig, Roman Zippel

[-- Attachment #1: hfs-clenaup-nls-unload.patch --]
[-- Type: text/plain, Size: 848 bytes --]

unload_nls() can be called with a NULL pointer now. Remove the pointer
checks.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Roman Zippel <zippel@linux-m68k.org>
---
 fs/hfs/mdb.c |    6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

Index: linux-2.6-tip/fs/hfs/mdb.c
===================================================================
--- linux-2.6-tip.orig/fs/hfs/mdb.c
+++ linux-2.6-tip/fs/hfs/mdb.c
@@ -344,10 +344,8 @@ void hfs_mdb_put(struct super_block *sb)
 	brelse(HFS_SB(sb)->mdb_bh);
 	brelse(HFS_SB(sb)->alt_mdb_bh);
 
-	if (HFS_SB(sb)->nls_io)
-		unload_nls(HFS_SB(sb)->nls_io);
-	if (HFS_SB(sb)->nls_disk)
-		unload_nls(HFS_SB(sb)->nls_disk);
+	unload_nls(HFS_SB(sb)->nls_io);
+	unload_nls(HFS_SB(sb)->nls_disk);
 
 	free_pages((unsigned long)HFS_SB(sb)->bitmap, PAGE_SIZE < 8192 ? 1 : 0);
 	kfree(HFS_SB(sb));



^ permalink raw reply	[flat|nested] 16+ messages in thread

* [patch 06/11] hfsplus: cleanup unload_nls() calls
  2009-08-14 12:42 [patch 00/11] Cleanup unload_nls() calls Thomas Gleixner
                   ` (4 preceding siblings ...)
  2009-08-14 12:42 ` [patch 05/11] hfs: clenaup unload_nls() calls Thomas Gleixner
@ 2009-08-14 12:43 ` Thomas Gleixner
  2009-08-14 12:43 ` [patch 07/11] isofs: " Thomas Gleixner
                   ` (5 subsequent siblings)
  11 siblings, 0 replies; 16+ messages in thread
From: Thomas Gleixner @ 2009-08-14 12:43 UTC (permalink / raw)
  To: LKML; +Cc: Al Viro, Christoph Hellwig, Roman Zippel

[-- Attachment #1: hfsplus-cleanup-nls-unload.patch --]
[-- Type: text/plain, Size: 890 bytes --]

unload_nls() can be called with a NULL pointer now. Remove the pointer
checks.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Roman Zippel <zippel@linux-m68k.org>
---
 fs/hfsplus/super.c |    6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

Index: linux-2.6-tip/fs/hfsplus/super.c
===================================================================
--- linux-2.6-tip.orig/fs/hfsplus/super.c
+++ linux-2.6-tip/fs/hfsplus/super.c
@@ -229,8 +229,7 @@ static void hfsplus_put_super(struct sup
 	iput(HFSPLUS_SB(sb).alloc_file);
 	iput(HFSPLUS_SB(sb).hidden_dir);
 	brelse(HFSPLUS_SB(sb).s_vhbh);
-	if (HFSPLUS_SB(sb).nls)
-		unload_nls(HFSPLUS_SB(sb).nls);
+	unload_nls(HFSPLUS_SB(sb).nls);
 	kfree(sb->s_fs_info);
 	sb->s_fs_info = NULL;
 
@@ -464,8 +463,7 @@ out:
 
 cleanup:
 	hfsplus_put_super(sb);
-	if (nls)
-		unload_nls(nls);
+	unload_nls(nls);
 	return err;
 }
 



^ permalink raw reply	[flat|nested] 16+ messages in thread

* [patch 07/11] isofs: cleanup unload_nls() calls
  2009-08-14 12:42 [patch 00/11] Cleanup unload_nls() calls Thomas Gleixner
                   ` (5 preceding siblings ...)
  2009-08-14 12:43 ` [patch 06/11] hfsplus: cleanup " Thomas Gleixner
@ 2009-08-14 12:43 ` Thomas Gleixner
  2009-08-14 12:43 ` [patch 08/11] jfs: " Thomas Gleixner
                   ` (4 subsequent siblings)
  11 siblings, 0 replies; 16+ messages in thread
From: Thomas Gleixner @ 2009-08-14 12:43 UTC (permalink / raw)
  To: LKML; +Cc: Al Viro, Christoph Hellwig

[-- Attachment #1: isofs-cleanup-nls-unload.patch --]
[-- Type: text/plain, Size: 1060 bytes --]

unload_nls() can be called with a NULL pointer now. Remove the pointer
checks and the NULLification of the pointers as the data structure
which contains the pointers is kfree'd right away.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
 fs/isofs/inode.c |    8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

Index: linux-2.6-tip/fs/isofs/inode.c
===================================================================
--- linux-2.6-tip.orig/fs/isofs/inode.c
+++ linux-2.6-tip/fs/isofs/inode.c
@@ -46,10 +46,7 @@ static void isofs_put_super(struct super
 #ifdef CONFIG_JOLIET
 	lock_kernel();
 
-	if (sbi->s_nls_iocharset) {
-		unload_nls(sbi->s_nls_iocharset);
-		sbi->s_nls_iocharset = NULL;
-	}
+	unload_nls(sbi->s_nls_iocharset);
 
 	unlock_kernel();
 #endif
@@ -912,8 +909,7 @@ out_no_root:
 		printk(KERN_WARNING "%s: get root inode failed\n", __func__);
 out_no_inode:
 #ifdef CONFIG_JOLIET
-	if (sbi->s_nls_iocharset)
-		unload_nls(sbi->s_nls_iocharset);
+	unload_nls(sbi->s_nls_iocharset);
 #endif
 	goto out_freesbi;
 out_no_read:



^ permalink raw reply	[flat|nested] 16+ messages in thread

* [patch 08/11] jfs: cleanup unload_nls() calls
  2009-08-14 12:42 [patch 00/11] Cleanup unload_nls() calls Thomas Gleixner
                   ` (6 preceding siblings ...)
  2009-08-14 12:43 ` [patch 07/11] isofs: " Thomas Gleixner
@ 2009-08-14 12:43 ` Thomas Gleixner
  2009-08-14 15:17   ` Dave Kleikamp
  2009-08-14 12:43 ` [patch 09/11] ncpfs: " Thomas Gleixner
                   ` (3 subsequent siblings)
  11 siblings, 1 reply; 16+ messages in thread
From: Thomas Gleixner @ 2009-08-14 12:43 UTC (permalink / raw)
  To: LKML; +Cc: Al Viro, Christoph Hellwig, Dave Kleikamp

[-- Attachment #1: jfs-clenaup-nls-unload.patch --]
[-- Type: text/plain, Size: 1189 bytes --]

unload_nls() can be called with a NULL pointer now. Remove the pointer
check and the NULLification of the pointer as the data structure which
contains the pointer is kfree'd right away.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Dave Kleikamp <shaggy@linux.vnet.ibm.com>

---
 fs/jfs/super.c |    9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

Index: linux-2.6-tip/fs/jfs/super.c
===================================================================
--- linux-2.6-tip.orig/fs/jfs/super.c
+++ linux-2.6-tip/fs/jfs/super.c
@@ -178,13 +178,11 @@ static void jfs_put_super(struct super_b
 	rc = jfs_umount(sb);
 	if (rc)
 		jfs_err("jfs_umount failed with return code %d", rc);
-	if (sbi->nls_tab)
-		unload_nls(sbi->nls_tab);
-	sbi->nls_tab = NULL;
+
+	unload_nls(sbi->nls_tab);
 
 	truncate_inode_pages(sbi->direct_inode->i_mapping, 0);
 	iput(sbi->direct_inode);
-	sbi->direct_inode = NULL;
 
 	kfree(sbi);
 
@@ -347,8 +345,7 @@ static int parse_options(char *options, 
 
 	if (nls_map != (void *) -1) {
 		/* Discard old (if remount) */
-		if (sbi->nls_tab)
-			unload_nls(sbi->nls_tab);
+		unload_nls(sbi->nls_tab);
 		sbi->nls_tab = nls_map;
 	}
 	return 1;



^ permalink raw reply	[flat|nested] 16+ messages in thread

* [patch 09/11] ncpfs: cleanup unload_nls() calls
  2009-08-14 12:42 [patch 00/11] Cleanup unload_nls() calls Thomas Gleixner
                   ` (7 preceding siblings ...)
  2009-08-14 12:43 ` [patch 08/11] jfs: " Thomas Gleixner
@ 2009-08-14 12:43 ` Thomas Gleixner
  2009-08-14 12:43 ` [patch 10/11] ntfs: " Thomas Gleixner
                   ` (2 subsequent siblings)
  11 siblings, 0 replies; 16+ messages in thread
From: Thomas Gleixner @ 2009-08-14 12:43 UTC (permalink / raw)
  To: LKML; +Cc: Al Viro, Christoph Hellwig, Petr Vandrovec

[-- Attachment #1: ncpfs-cleanup-nls-unload.patch --]
[-- Type: text/plain, Size: 1467 bytes --]

unload_nls() can be called with a NULL pointer now. Remove the pointer
checks and the NULLification of the pointers as the data structure
which contains the pointers is kfree'd right away.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Petr Vandrovec <vandrove@vc.cvut.cz>
---
 fs/ncpfs/inode.c |   12 ++----------
 fs/ncpfs/ioctl.c |    6 ++----
 2 files changed, 4 insertions(+), 14 deletions(-)

Index: linux-2.6-tip/fs/ncpfs/inode.c
===================================================================
--- linux-2.6-tip.orig/fs/ncpfs/inode.c
+++ linux-2.6-tip/fs/ncpfs/inode.c
@@ -746,16 +746,8 @@ static void ncp_put_super(struct super_b
 
 #ifdef CONFIG_NCPFS_NLS
 	/* unload the NLS charsets */
-	if (server->nls_vol)
-	{
-		unload_nls(server->nls_vol);
-		server->nls_vol = NULL;
-	}
-	if (server->nls_io)
-	{
-		unload_nls(server->nls_io);
-		server->nls_io = NULL;
-	}
+	unload_nls(server->nls_vol);
+	unload_nls(server->nls_io);
 #endif /* CONFIG_NCPFS_NLS */
 
 	if (server->info_filp)
Index: linux-2.6-tip/fs/ncpfs/ioctl.c
===================================================================
--- linux-2.6-tip.orig/fs/ncpfs/ioctl.c
+++ linux-2.6-tip/fs/ncpfs/ioctl.c
@@ -223,10 +223,8 @@ ncp_set_charsets(struct ncp_server* serv
 	oldset_io = server->nls_io;
 	server->nls_io = iocharset;
 
-	if (oldset_cp)
-		unload_nls(oldset_cp);
-	if (oldset_io)
-		unload_nls(oldset_io);
+	unload_nls(oldset_cp);
+	unload_nls(oldset_io);
 
 	return 0;
 }



^ permalink raw reply	[flat|nested] 16+ messages in thread

* [patch 10/11] ntfs: cleanup unload_nls() calls
  2009-08-14 12:42 [patch 00/11] Cleanup unload_nls() calls Thomas Gleixner
                   ` (8 preceding siblings ...)
  2009-08-14 12:43 ` [patch 09/11] ncpfs: " Thomas Gleixner
@ 2009-08-14 12:43 ` Thomas Gleixner
  2009-08-14 12:43 ` [patch 11/11] smbfs: " Thomas Gleixner
  2009-08-16 14:46 ` [patch 00/11] Cleanup " Christoph Hellwig
  11 siblings, 0 replies; 16+ messages in thread
From: Thomas Gleixner @ 2009-08-14 12:43 UTC (permalink / raw)
  To: LKML; +Cc: Al Viro, Christoph Hellwig, Anton Altaparmakov

[-- Attachment #1: ntfs-cleanup-nls-unload.patch --]
[-- Type: text/plain, Size: 1067 bytes --]

unload_nls() can be called with a NULL pointer now. Remove the pointer
checks and the NULLification of the pointers as the data structure
which contains the pointers is kfree'd right away.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Anton Altaparmakov <aia21@cantab.net>
---
 fs/ntfs/super.c |   10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

Index: linux-2.6-tip/fs/ntfs/super.c
===================================================================
--- linux-2.6-tip.orig/fs/ntfs/super.c
+++ linux-2.6-tip/fs/ntfs/super.c
@@ -201,8 +201,7 @@ use_utf8:
 						v, old_nls->charset);
 				nls_map = old_nls;
 			} else /* nls_map */ {
-				if (old_nls)
-					unload_nls(old_nls);
+				unload_nls(old_nls);
 			}
 		} else if (!strcmp(p, "utf8")) {
 			bool val = false;
@@ -2427,10 +2426,9 @@ static void ntfs_put_super(struct super_
 		ntfs_free(vol->upcase);
 		vol->upcase = NULL;
 	}
-	if (vol->nls_map) {
-		unload_nls(vol->nls_map);
-		vol->nls_map = NULL;
-	}
+
+	unload_nls(vol->nls_map);
+
 	sb->s_fs_info = NULL;
 	kfree(vol);
 



^ permalink raw reply	[flat|nested] 16+ messages in thread

* [patch 11/11] smbfs: cleanup unload_nls() calls
  2009-08-14 12:42 [patch 00/11] Cleanup unload_nls() calls Thomas Gleixner
                   ` (9 preceding siblings ...)
  2009-08-14 12:43 ` [patch 10/11] ntfs: " Thomas Gleixner
@ 2009-08-14 12:43 ` Thomas Gleixner
  2009-08-16 14:46 ` [patch 00/11] Cleanup " Christoph Hellwig
  11 siblings, 0 replies; 16+ messages in thread
From: Thomas Gleixner @ 2009-08-14 12:43 UTC (permalink / raw)
  To: LKML; +Cc: Al Viro, Christoph Hellwig

[-- Attachment #1: smbfs-cleanup-nls-unload.patch --]
[-- Type: text/plain, Size: 913 bytes --]

unload_nls() can be called with a NULL pointer now. Remove the pointer
checks and the NULLification of the pointers as the data structure
which contains the pointers is kfree'd right away.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
 fs/smbfs/inode.c |   10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

Index: linux-2.6-tip/fs/smbfs/inode.c
===================================================================
--- linux-2.6-tip.orig/fs/smbfs/inode.c
+++ linux-2.6-tip/fs/smbfs/inode.c
@@ -459,14 +459,8 @@ smb_show_options(struct seq_file *s, str
 static void
 smb_unload_nls(struct smb_sb_info *server)
 {
-	if (server->remote_nls) {
-		unload_nls(server->remote_nls);
-		server->remote_nls = NULL;
-	}
-	if (server->local_nls) {
-		unload_nls(server->local_nls);
-		server->local_nls = NULL;
-	}
+	unload_nls(server->remote_nls);
+	unload_nls(server->local_nls);
 }
 
 static void



^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [patch 02/11] fat: cleanup fat_put_super()
  2009-08-14 12:42 ` [patch 02/11] fat: cleanup fat_put_super() Thomas Gleixner
@ 2009-08-14 13:12   ` OGAWA Hirofumi
  0 siblings, 0 replies; 16+ messages in thread
From: OGAWA Hirofumi @ 2009-08-14 13:12 UTC (permalink / raw)
  To: Thomas Gleixner; +Cc: LKML, Al Viro, Christoph Hellwig

Thomas Gleixner <tglx@linutronix.de> writes:

> unload_nls() can be called with a NULL pointer now. Remove the pointer
> checks and the NULLification of the pointers as the data structure
> which contains the pointers is kfree'd right away.
>
> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
> Cc: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
> ---
>  fs/fat/inode.c |   16 ++++------------
>  1 file changed, 4 insertions(+), 12 deletions(-)
>
> Index: linux-2.6-tip/fs/fat/inode.c
> ===================================================================
> --- linux-2.6-tip.orig/fs/fat/inode.c
> +++ linux-2.6-tip/fs/fat/inode.c
> @@ -470,19 +470,11 @@ static void fat_put_super(struct super_b
>  
>  	iput(sbi->fat_inode);
>  
> -	if (sbi->nls_disk) {
> -		unload_nls(sbi->nls_disk);
> -		sbi->nls_disk = NULL;
> -		sbi->options.codepage = fat_default_codepage;
> -	}
> -	if (sbi->nls_io) {
> -		unload_nls(sbi->nls_io);
> -		sbi->nls_io = NULL;
> -	}
> -	if (sbi->options.iocharset != fat_default_iocharset) {
> +	unload_nls(sbi->nls_disk);
> +	unload_nls(sbi->nls_io);

I don't object to this, however, personally I'd prefer to check NULL
explicitly, including brelse().

Thanks.
-- 
OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [patch 08/11] jfs: cleanup unload_nls() calls
  2009-08-14 12:43 ` [patch 08/11] jfs: " Thomas Gleixner
@ 2009-08-14 15:17   ` Dave Kleikamp
  0 siblings, 0 replies; 16+ messages in thread
From: Dave Kleikamp @ 2009-08-14 15:17 UTC (permalink / raw)
  To: Thomas Gleixner; +Cc: LKML, Al Viro, Christoph Hellwig

On Fri, 2009-08-14 at 12:43 +0000, Thomas Gleixner wrote:

> unload_nls() can be called with a NULL pointer now. Remove the pointer
> check and the NULLification of the pointer as the data structure which
> contains the pointer is kfree'd right away.
> 
> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Dave Kleikamp <shaggy@linux.vnet.ibm.com>

> ---
>  fs/jfs/super.c |    9 +++------
>  1 file changed, 3 insertions(+), 6 deletions(-)

-- 
David Kleikamp
IBM Linux Technology Center


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [patch 00/11] Cleanup unload_nls() calls
  2009-08-14 12:42 [patch 00/11] Cleanup unload_nls() calls Thomas Gleixner
                   ` (10 preceding siblings ...)
  2009-08-14 12:43 ` [patch 11/11] smbfs: " Thomas Gleixner
@ 2009-08-16 14:46 ` Christoph Hellwig
  2009-08-16 15:00   ` Thomas Gleixner
  11 siblings, 1 reply; 16+ messages in thread
From: Christoph Hellwig @ 2009-08-16 14:46 UTC (permalink / raw)
  To: Thomas Gleixner; +Cc: LKML, Al Viro, Christoph Hellwig

On Fri, Aug 14, 2009 at 12:42:36PM -0000, Thomas Gleixner wrote:
> While looking through the BKL call sites in fs/* I noticed that most
> callsites of unload_nls() do 
> 
> 	  if (nls) 
> 	     	   unload_nls(nls);
> 
> The patch series moves the NULL pointer check into unload_nls() and
> cleans up the various users.

This looks all good to me.  But I'd just make it a single patch..


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [patch 00/11] Cleanup unload_nls() calls
  2009-08-16 14:46 ` [patch 00/11] Cleanup " Christoph Hellwig
@ 2009-08-16 15:00   ` Thomas Gleixner
  0 siblings, 0 replies; 16+ messages in thread
From: Thomas Gleixner @ 2009-08-16 15:00 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: LKML, Al Viro

On Sun, 16 Aug 2009, Christoph Hellwig wrote:

> On Fri, Aug 14, 2009 at 12:42:36PM -0000, Thomas Gleixner wrote:
> > While looking through the BKL call sites in fs/* I noticed that most
> > callsites of unload_nls() do 
> > 
> > 	  if (nls) 
> > 	     	   unload_nls(nls);
> > 
> > The patch series moves the NULL pointer check into unload_nls() and
> > cleans up the various users.
> 
> This looks all good to me.  But I'd just make it a single patch..

Sure, should go via Al, right ?

Thanks,

	tglx
 

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2009-08-16 15:00 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-08-14 12:42 [patch 00/11] Cleanup unload_nls() calls Thomas Gleixner
2009-08-14 12:42 ` [patch 01/11] fs: Make unload_nls() NULL pointer safe Thomas Gleixner
2009-08-14 12:42 ` [patch 02/11] fat: cleanup fat_put_super() Thomas Gleixner
2009-08-14 13:12   ` OGAWA Hirofumi
2009-08-14 12:42 ` [patch 03/11] befs: cleanup befs_put_super() Thomas Gleixner
2009-08-14 12:42 ` [patch 04/11] cifs: cleanup unload_nls() call Thomas Gleixner
2009-08-14 12:42 ` [patch 05/11] hfs: clenaup unload_nls() calls Thomas Gleixner
2009-08-14 12:43 ` [patch 06/11] hfsplus: cleanup " Thomas Gleixner
2009-08-14 12:43 ` [patch 07/11] isofs: " Thomas Gleixner
2009-08-14 12:43 ` [patch 08/11] jfs: " Thomas Gleixner
2009-08-14 15:17   ` Dave Kleikamp
2009-08-14 12:43 ` [patch 09/11] ncpfs: " Thomas Gleixner
2009-08-14 12:43 ` [patch 10/11] ntfs: " Thomas Gleixner
2009-08-14 12:43 ` [patch 11/11] smbfs: " Thomas Gleixner
2009-08-16 14:46 ` [patch 00/11] Cleanup " Christoph Hellwig
2009-08-16 15:00   ` Thomas Gleixner

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.