From: Julia Lawall <julia@diku.dk>
To: Ramkrishna Vepa <ram.vepa@neterion.com>,
Rastapur Santosh <santosh.rastapur@neterion.com>,
Sivakumar Subramani <sivakumar.subramani@neterion.com>,
Sreenivasa Honnur <sreenivasa.honnur@neterion.com>,
Anil Murthy <anil.murthy@neterion.com>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
kernel-janitors@vger.kernel.org
Subject: [PATCH 2/5] drivers/net: drop redundant memset
Date: Tue, 9 Mar 2010 22:14:11 +0100 (CET) [thread overview]
Message-ID: <Pine.LNX.4.64.1003092213500.4974@ask.diku.dk> (raw)
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/net/s2io.c | 4 +---
1 files changed, 1 insertions(+), 3 deletions(-)
diff --git a/drivers/net/s2io.c b/drivers/net/s2io.c
index df70657..2eb7f8a 100644
--- a/drivers/net/s2io.c
+++ b/drivers/net/s2io.c
@@ -5819,10 +5819,8 @@ static void s2io_vpd_read(struct s2io_nic *nic)
}
}
- if ((!fail) && (vpd_data[1] < VPD_STRING_LEN)) {
- memset(nic->product_name, 0, vpd_data[1]);
+ if ((!fail) && (vpd_data[1] < VPD_STRING_LEN))
memcpy(nic->product_name, &vpd_data[3], vpd_data[1]);
- }
kfree(vpd_data);
swstats->mem_freed += 256;
}
next reply other threads:[~2010-03-09 21:14 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-03-09 21:14 Julia Lawall [this message]
2010-03-15 22:47 ` David Miller
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=Pine.LNX.4.64.1003092213500.4974@ask.diku.dk \
--to=julia@diku.dk \
--cc=anil.murthy@neterion.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=ram.vepa@neterion.com \
--cc=santosh.rastapur@neterion.com \
--cc=sivakumar.subramani@neterion.com \
--cc=sreenivasa.honnur@neterion.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®