[PATCH] Fs: Improvement in code readability when memdup_user()fails.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: "Sachin Shukla"<sachin.s5@xxxxxxxxxxx)>

There is no need to call kfree() if memdup_user() fails, as no memory
was allocated and the error in the error-valued pointer should be returned.

Signed-off-by: Sachin Shukla <sachin.s5@xxxxxxxxxxx>
---
 fs/ioctl.c |    7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/fs/ioctl.c b/fs/ioctl.c
index c415668..1103c5d 100644
--- a/fs/ioctl.c
+++ b/fs/ioctl.c
@@ -588,11 +588,8 @@ static int ioctl_file_dedupe_range(struct file *file, void __user *arg)
 	}
 
 	same = memdup_user(argp, size);
-	if (IS_ERR(same)) {
-		ret = PTR_ERR(same);
-		same = NULL;
-		goto out;
-	}
+	if (IS_ERR(same))
+		return PTR_ERR(same);
 
 	same->dest_count = count;
 	ret = vfs_dedupe_file_range(file, same);
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux