[<prev] [next>] [day] [month] [year] [list]
Message-ID: <1434438213-4792-1-git-send-email-habdul@visteon.com>
Date: Tue, 16 Jun 2015 07:04:51 +0000
From: "Abdul, Hussain (H.)" <habdul@...teon.com>
To: "gregkh@...uxfoundation.org" <gregkh@...uxfoundation.org>
CC: "oleg.drokin@...el.com" <oleg.drokin@...el.com>,
"andreas.dilger@...el.com" <andreas.dilger@...el.com>,
"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>,
"Ravindran, Madhusudhanan (M.)" <mravindr@...teon.com>,
"Dighe, Niranjan (N.)" <ndighe@...teon.com>
Subject: [PATCH] Staging: lustre: Use memdup_user rather than duplicating its
implementation
From: Abdul Hussain <habdul@...teon.com>
This patch uses memdup_user rather than duplicating its implementation
Signed-off-by: Abdul Hussain <habdul@...teon.com>
---
drivers/staging/lustre/lustre/llite/file.c | 22 ++++++----------------
1 file changed, 6 insertions(+), 16 deletions(-)
diff --git a/drivers/staging/lustre/lustre/llite/file.c b/drivers/staging/lustre/lustre/llite/file.c
index 4f9b1c7..3075db2 100644
--- a/drivers/staging/lustre/lustre/llite/file.c
+++ b/drivers/staging/lustre/lustre/llite/file.c
@@ -2361,14 +2361,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))) {
- kfree(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);
@@ -2488,14 +2483,9 @@ ll_file_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
case LL_IOC_HSM_IMPORT: {
struct hsm_user_import *hui;
- hui = kzalloc(sizeof(*hui), GFP_NOFS);
- if (!hui)
- return -ENOMEM;
-
- if (copy_from_user(hui, (void *)arg, sizeof(*hui))) {
- kfree(hui);
- return -EFAULT;
- }
+ hui = memdup_user((void *)arg, sizeof(*hui));
+ if (IS_ERR(hui))
+ return PTR_ERR(hui);
rc = ll_hsm_import(inode, file, hui);
--
1.9.1
--
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