[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20150331150933.GA2833@chaitanya-Ideapad-Z560>
Date: Tue, 31 Mar 2015 15:10:33 +0000
From: "Dhere, Chaitanya (C.)" <cvijaydh@...teon.com>
To: "oleg.drokin@...el.com" <oleg.drokin@...el.com>,
"andreas.dilger@...el.com" <andreas.dilger@...el.com>,
"gregkh@...uxfoundation.org" <gregkh@...uxfoundation.org>,
"viro@...iv.linux.org.uk" <viro@...iv.linux.org.uk>,
"jinshan.xiong@...el.com" <jinshan.xiong@...el.com>,
"aybuke.147@...il.com" <aybuke.147@...il.com>,
"john.hammond@...el.com" <john.hammond@...el.com>,
"Julia.Lawall@...6.fr" <Julia.Lawall@...6.fr>
CC: "HPDD-discuss@...ts.01.org" <HPDD-discuss@...ts.01.org>,
"devel@...verdev.osuosl.org" <devel@...verdev.osuosl.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: [PATCH] staging: lustre: replace kzalloc with copy_from_user with
memdup_user
This patch replaces kzalloc and copy_from_user with memdup_user call
This change was detected with coccinelle tool
Signed-off-by: Chaitanya Dhere <cvijaydh@...teon.com>
---
drivers/staging/lustre/lustre/llite/file.c | 11 +++--------
1 file changed, 3 insertions(+), 8 deletions(-)
diff --git a/drivers/staging/lustre/lustre/llite/file.c b/drivers/staging/lustre/lustre/llite/file.c
index 85e74d1..85b5567 100644
--- a/drivers/staging/lustre/lustre/llite/file.c
+++ b/drivers/staging/lustre/lustre/llite/file.c
@@ -2368,14 +2368,9 @@ ll_file_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
struct hsm_state_set *hss;
int rc;
- hss = kzalloc(sizeof(*hss), GFP_NOFS);
- if (!hss)
- return -ENOMEM;
-
- if (copy_from_user(hss, (char *)arg, sizeof(*hss))) {
- OBD_FREE_PTR(hss);
- return -EFAULT;
- }
+ hss = memdup_user((char *)arg, sizeof(*hss));
+ if (IS_ERR(hss))
+ return PTR_ERR(hss);
rc = ll_hsm_state_set(inode, hss);
--
1.7.9.5
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists