From: "jack wang" <jack_wang@usish.com>
To: "'Julia Lawall'" <julia@diku.dk>, <lindar_liu@usish.com>,
"'James E.J. Bottomley'" <James.Bottomley@suse.de>,
<linux-scsi@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
<kernel-janitors@vger.kernel.org>
Subject: RE: [PATCH 3/5] drivers/scsi: drop redundant memset
Date: Wed, 10 Mar 2010 09:05:07 +0800 [thread overview]
Message-ID: <B8AD7A70524143C289C05DFE9857EC84@usish.com.cn> (raw)
In-Reply-To: <Pine.LNX.4.64.1003092214110.4974@ask.diku.dk>
From: Julia Lawall <julia@diku.dk>
The region set by the call to memset is immediately overwritten by the
subsequent call to memcpy.
The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)
// <smpl>
@@
expression e1,e2,e3,e4;
@@
- memset(e1,e2,e3);
memcpy(e1,e4,e3);
// </smpl>
Signed-off-by: Julia Lawall <julia@diku.dk>
---
drivers/scsi/pm8001/pm8001_hwi.c | 1 -
1 file changed, 1 deletion(-)
diff -u -p a/drivers/scsi/pm8001/pm8001_hwi.c
b/drivers/scsi/pm8001/pm8001_hwi.c
--- a/drivers/scsi/pm8001/pm8001_hwi.c
+++ b/drivers/scsi/pm8001/pm8001_hwi.c
@@ -4389,7 +4389,6 @@ pm8001_chip_fw_flash_update_req(struct p
return -ENOMEM;
}
}
- memset(buffer, 0, fw_control->len);
memcpy(buffer, fw_control->buffer, fw_control->len);
flash_update_info.sgl.addr = cpu_to_le64(phys_addr);
flash_update_info.sgl.im_len.len = cpu_to_le32(fw_control->len);
[Jack] Thanks Julia.
Acked-by: Jack Wang <jack_wang@usish.com>
prev parent reply other threads:[~2010-03-10 1:05 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-03-09 21:14 Julia Lawall
2010-03-10 1:05 ` jack wang [this message]
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=B8AD7A70524143C289C05DFE9857EC84@usish.com.cn \
--to=jack_wang@usish.com \
--cc=James.Bottomley@suse.de \
--cc=julia@diku.dk \
--cc=kernel-janitors@vger.kernel.org \
--cc=lindar_liu@usish.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
/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®