From: "Abdul, Hussain (H.)" <habdul@visteon.com>
To: "gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>
Cc: "oleg.drokin@intel.com" <oleg.drokin@intel.com>,
"andreas.dilger@intel.com" <andreas.dilger@intel.com>,
"HPDD-discuss@lists.01.org" <HPDD-discuss@ml01.01.org>,
"devel@driverdev.osuosl.org" <devel@driverdev.osuosl.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"Ravindran, Madhusudhanan (M.)" <mravindr@visteon.com>,
"Dighe, Niranjan (N.)" <ndighe@visteon.com>
Subject: [PATCH] Staging: lustre: Use memdup_user rather than duplicating its implementation
Date: Tue, 16 Jun 2015 07:04:51 +0000 [thread overview]
Message-ID: <1434438213-4792-1-git-send-email-habdul@visteon.com> (raw)
From: Abdul Hussain <habdul@visteon.com>
This patch uses memdup_user rather than duplicating its implementation
Signed-off-by: Abdul Hussain <habdul@visteon.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
next reply other threads:[~2015-06-16 7:05 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-16 7:04 Abdul, Hussain (H.) [this message]
2015-06-16 7:05 Abdul, Hussain (H.)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1434438213-4792-1-git-send-email-habdul@visteon.com \
--to=habdul@visteon.com \
--cc=HPDD-discuss@ml01.01.org \
--cc=andreas.dilger@intel.com \
--cc=devel@driverdev.osuosl.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mravindr@visteon.com \
--cc=ndighe@visteon.com \
--cc=oleg.drokin@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®