* [patch] bnx2x: use strlcpy() to copy a string
@ 2012-10-02 11:47 Dan Carpenter
2012-10-03 2:41 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2012-10-02 11:47 UTC (permalink / raw)
To: Eilon Greenstein; +Cc: netdev, kernel-janitors
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>
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
index f7ed122..d5648fc 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,
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [patch] bnx2x: use strlcpy() to copy a string
2012-10-02 11:47 [patch] bnx2x: use strlcpy() to copy a string Dan Carpenter
@ 2012-10-03 2:41 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2012-10-03 2:41 UTC (permalink / raw)
To: dan.carpenter; +Cc: eilong, netdev, kernel-janitors
From: Dan Carpenter <dan.carpenter@oracle.com>
Date: Tue, 2 Oct 2012 14:47:46 +0300
> 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>
Applied, thanks Dan.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-10-03 2:41 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-10-02 11:47 [patch] bnx2x: use strlcpy() to copy a string Dan Carpenter
2012-10-03 2:41 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).