* [PATCH] Fs: Improvement in code readability when memdup_user()fails.
@ 2016-11-11 9:02 Sachin Shukla
0 siblings, 0 replies; only message in thread
From: Sachin Shukla @ 2016-11-11 9:02 UTC (permalink / raw)
To: Alexander Viro, linux-fsdevel, linux-kernel, sachiniiitm
Cc: ravikant.s2, p.shailesh, ashish.kalra, vidushi.koul
From: "Sachin Shukla"<sachin.s5@samsung.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@samsung.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
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2016-11-11 9:04 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-11-11 9:02 [PATCH] Fs: Improvement in code readability when memdup_user()fails Sachin Shukla
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).