[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <2364b445dcd0b33f0d8d1b069a9dc278@mail.gmail.com>
Date: Mon, 22 Aug 2016 15:01:14 +0530
From: Sumit Saxena <sumit.saxena@...adcom.com>
To: SF Markus Elfring <elfring@...rs.sourceforge.net>,
linux-scsi@...r.kernel.org, megaraidlinux.pdl@...gotech.com,
"James E. J. Bottomley" <jejb@...ux.vnet.ibm.com>,
Kashyap Desai <kashyap.desai@...gotech.com>,
"Martin K. Petersen" <martin.petersen@...cle.com>,
Sumit Saxena <sumit.saxena@...gotech.com>,
Uday Lingala <uday.lingala@...gotech.com>
Cc: LKML <linux-kernel@...r.kernel.org>,
kernel-janitors@...r.kernel.org,
Julia Lawall <julia.lawall@...6.fr>
Subject: RE: [PATCH] megaraid_sas: Use memdup_user() rather than duplicating
its implementation
>-----Original Message-----
>From: SF Markus Elfring [mailto:elfring@...rs.sourceforge.net]
>Sent: Sunday, August 21, 2016 2:19 PM
>To: linux-scsi@...r.kernel.org; megaraidlinux.pdl@...gotech.com; James E.
>J.
>Bottomley; Kashyap Desai; Martin K. Petersen; Sumit Saxena; Uday Lingala
>Cc: LKML; kernel-janitors@...r.kernel.org; Julia Lawall
>Subject: [PATCH] megaraid_sas: Use memdup_user() rather than duplicating
>its
>implementation
>
>From: Markus Elfring <elfring@...rs.sourceforge.net>
>Date: Sun, 21 Aug 2016 10:39:04 +0200
>
>Reuse existing functionality from memdup_user() instead of keeping
>duplicate
>source code.
>
>This issue was detected by using the Coccinelle software.
>
>Signed-off-by: Markus Elfring <elfring@...rs.sourceforge.net>
>---
> drivers/scsi/megaraid/megaraid_sas_base.c | 11 +++--------
> 1 file changed, 3 insertions(+), 8 deletions(-)
>
>diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c
>b/drivers/scsi/megaraid/megaraid_sas_base.c
>index c1ed25a..9a2fe4e 100644
>--- a/drivers/scsi/megaraid/megaraid_sas_base.c
>+++ b/drivers/scsi/megaraid/megaraid_sas_base.c
>@@ -6711,14 +6711,9 @@ static int megasas_mgmt_ioctl_fw(struct file *file,
>unsigned long arg)
> unsigned long flags;
> u32 wait_time = MEGASAS_RESET_WAIT_TIME;
>
>- ioc = kmalloc(sizeof(*ioc), GFP_KERNEL);
>- if (!ioc)
>- return -ENOMEM;
>-
>- if (copy_from_user(ioc, user_ioc, sizeof(*ioc))) {
>- error = -EFAULT;
>- goto out_kfree_ioc;
>- }
>+ ioc = memdup_user(user_ioc, sizeof(*ioc));
>+ if (IS_ERR(ioc))
>+ return PTR_ERR(ioc);
>
> instance = megasas_lookup_instance(ioc->host_no);
> if (!instance) {
Acked by: Sumit Saxena <sumit.saxena@...adcom.com>
>--
>2.9.3
Powered by blists - more mailing lists