From: Chen Zhou <chenzhou10@huawei.com>
To: <hare@suse.com>, <jejb@linux.ibm.com>, <martin.petersen@oracle.com>
Cc: <linux-scsi@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
<chenzhou10@huawei.com>
Subject: [PATCH] scsi: aic7xxx: use kmemdup
Date: Wed, 8 Jan 2020 19:29:53 +0800 [thread overview]
Message-ID: <20200108112953.41808-1-chenzhou10@huawei.com> (raw)
Fix memdup.cocci warnings:
./drivers/scsi/aic7xxx/aic79xx_core.c:9445:27-34: WARNING opportunity for kmemdup
Use kmemdup rather than duplicating its implementation.
Signed-off-by: Chen Zhou <chenzhou10@huawei.com>
---
drivers/scsi/aic7xxx/aic79xx_core.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/scsi/aic7xxx/aic79xx_core.c b/drivers/scsi/aic7xxx/aic79xx_core.c
index 7e5044b..f4bc88c 100644
--- a/drivers/scsi/aic7xxx/aic79xx_core.c
+++ b/drivers/scsi/aic7xxx/aic79xx_core.c
@@ -9442,10 +9442,9 @@ ahd_loadseq(struct ahd_softc *ahd)
if (cs_count != 0) {
cs_count *= sizeof(struct cs);
- ahd->critical_sections = kmalloc(cs_count, GFP_ATOMIC);
+ ahd->critical_sections = kmemdup(cs_table, cs_count, GFP_ATOMIC);
if (ahd->critical_sections == NULL)
panic("ahd_loadseq: Could not malloc");
- memcpy(ahd->critical_sections, cs_table, cs_count);
}
ahd_outb(ahd, SEQCTL0, PERRORDIS|FAILDIS|FASTMODE);
--
2.7.4
next reply other threads:[~2020-01-08 11:34 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-08 11:29 Chen Zhou [this message]
-- strict thread matches above, loose matches on Subject: below --
2016-05-19 14:08 [PATCH] [SCSI] aic79xx: use kmemdup Muhammad Falak R Wani
2016-05-19 14:08 ` [PATCH] [SCSI] aic7xxx: " Muhammad Falak R Wani
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=20200108112953.41808-1-chenzhou10@huawei.com \
--to=chenzhou10@huawei.com \
--cc=hare@suse.com \
--cc=jejb@linux.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.