diff options
author | Dan Carpenter <dan.carpenter@oracle.com> | 2012-10-02 03:47:46 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-10-03 04:41:17 +0200 |
commit | 786fdf0bbf1c3a1b402bb2da946b93e0b36a8f32 (patch) | |
tree | 3d11a64015c2ee8cb8e633326ec2d0865ffaa97b | |
parent | ipv6: don't add link local route when there is no link local address (diff) | |
download | linux-786fdf0bbf1c3a1b402bb2da946b93e0b36a8f32.tar.xz linux-786fdf0bbf1c3a1b402bb2da946b93e0b36a8f32.zip |
bnx2x: use strlcpy() to copy a string
DRV_MODULE_VERSION is smaller than the ->version buffer so the memcpy()
copies 1 byte past the end of the string. It's not super harmful, but
it makes the static checkers complain.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c index f7ed122f4071..d5648fc666bd 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c @@ -3052,9 +3052,8 @@ static void bnx2x_drv_info_ether_stat(struct bnx2x *bp) struct eth_stats_info *ether_stat = &bp->slowpath->drv_info_to_mcp.ether_stat; - /* leave last char as NULL */ - memcpy(ether_stat->version, DRV_MODULE_VERSION, - ETH_STAT_INFO_VERSION_LEN - 1); + strlcpy(ether_stat->version, DRV_MODULE_VERSION, + ETH_STAT_INFO_VERSION_LEN); bp->sp_objs[0].mac_obj.get_n_elements(bp, &bp->sp_objs[0].mac_obj, DRV_INFO_ETH_STAT_NUM_MACS_REQUIRED, |