lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Date:   Fri, 11 Nov 2016 14:32:24 +0530
From:   Sachin Shukla <sachin.s5@...sung.com>
To:     Alexander Viro <viro@...iv.linux.org.uk>,
        linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org,
        sachiniiitm@...il.com
Cc:     ravikant.s2@...sung.com, p.shailesh@...sung.com,
        ashish.kalra@...sung.com, vidushi.koul@...sung.com
Subject: [PATCH] Fs: Improvement in code readability when memdup_user()fails.

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

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@...sung.com>
---
 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

Powered by blists - more mailing lists