[PATCH] kfree() NULL pointer cleanups - no need to check - fs/ext3/

Jesper Juhl juhl-lkml at dif.dk
Wed Mar 30 19:02:37 UTC 2005


On Tue, 29 Mar 2005, Andreas Gruenbacher wrote:

> On Friday 25 March 2005 23:11, Jesper Juhl wrote:
> > kfree() handles NULL pointers fine - checking is redundant.
> 
> Looks good. Can you also fix that in fs/ext2/acl.c?
> 
No problem. I already send this patch to lkml earlier, but here it is 
again :


Remove redundant NULL checks before kfree() in fs/ext2/acl.c

Signed-off-by: Jesper Juhl <juhl-lkml at dif.dk>

--- linux-2.6.12-rc1-mm3-orig/fs/ext2/acl.c	2005-03-02 08:38:18.000000000 +0100
+++ linux-2.6.12-rc1-mm3/fs/ext2/acl.c	2005-03-25 22:41:07.000000000 +0100
@@ -194,8 +194,7 @@ ext2_get_acl(struct inode *inode, int ty
 		acl = NULL;
 	else
 		acl = ERR_PTR(retval);
-	if (value)
-		kfree(value);
+	kfree(value);
 
 	if (!IS_ERR(acl)) {
 		switch(type) {
@@ -262,8 +261,7 @@ ext2_set_acl(struct inode *inode, int ty
 
 	error = ext2_xattr_set(inode, name_index, "", value, size, 0);
 
-	if (value)
-		kfree(value);
+	kfree(value);
 	if (!error) {
 		switch(type) {
 			case ACL_TYPE_ACCESS:



-- 
Jesper Juhl




More information about the Ext3-users mailing list