[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <1534162924-27490-1-git-send-email-zhongjiang@huawei.com>
Date: Mon, 13 Aug 2018 20:22:04 +0800
From: zhong jiang <zhongjiang@...wei.com>
To: <don.brace@...rosemi.com>, <jejb@...ux.vnet.ibm.com>,
<martin.petersen@...cle.com>
CC: <linux-kernel@...r.kernel.org>
Subject: [PATCH] scsi: Use vmemdup_user to replace the open code
vmemdup_user is better than duplicating its implementation, So just
replace the open code.
Signed-off-by: zhong jiang <zhongjiang@...wei.com>
---
drivers/scsi/hpsa.c | 10 +++-------
1 file changed, 3 insertions(+), 7 deletions(-)
diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
index 58bb70b..948576a 100644
--- a/drivers/scsi/hpsa.c
+++ b/drivers/scsi/hpsa.c
@@ -6381,13 +6381,9 @@ static int hpsa_big_passthru_ioctl(struct ctlr_info *h, void __user *argp)
return -EINVAL;
if (!capable(CAP_SYS_RAWIO))
return -EPERM;
- ioc = kmalloc(sizeof(*ioc), GFP_KERNEL);
- if (!ioc) {
- status = -ENOMEM;
- goto cleanup1;
- }
- if (copy_from_user(ioc, argp, sizeof(*ioc))) {
- status = -EFAULT;
+ ioc = vmemdup_user(argp, sizeof(*ioc));
+ if (IS_ERR(ioc)) {
+ status = PTR_ERR(ioc);
goto cleanup1;
}
if ((ioc->buf_size < 1) &&
--
1.7.12.4
Powered by blists - more mailing lists