Skip to content

Commit

Permalink
drivers/net: drop redundant memset
Browse files Browse the repository at this point in the history
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>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Julia Lawall authored and David S. Miller committed Mar 15, 2010
1 parent 255f5c3 commit 876e956
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions drivers/net/s2io.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 876e956

Please sign in to comment.