Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 786fdf0b authored by Dan Carpenter's avatar Dan Carpenter Committed by David S. Miller
Browse files

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: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 62b54dd9
Loading
Loading
Loading
Loading
+2 −3
Original line number Original line Diff line number Diff line
@@ -3052,9 +3052,8 @@ static void bnx2x_drv_info_ether_stat(struct bnx2x *bp)
	struct eth_stats_info *ether_stat =
	struct eth_stats_info *ether_stat =
		&bp->slowpath->drv_info_to_mcp.ether_stat;
		&bp->slowpath->drv_info_to_mcp.ether_stat;


	/* leave last char as NULL */
	strlcpy(ether_stat->version, DRV_MODULE_VERSION,
	memcpy(ether_stat->version, DRV_MODULE_VERSION,
		ETH_STAT_INFO_VERSION_LEN);
	       ETH_STAT_INFO_VERSION_LEN - 1);


	bp->sp_objs[0].mac_obj.get_n_elements(bp, &bp->sp_objs[0].mac_obj,
	bp->sp_objs[0].mac_obj.get_n_elements(bp, &bp->sp_objs[0].mac_obj,
					DRV_INFO_ETH_STAT_NUM_MACS_REQUIRED,
					DRV_INFO_ETH_STAT_NUM_MACS_REQUIRED,