ethtool: fix drvinfo strings set in drivers
Use strlcpy where possible to ensure the string is \0 terminated. Use always sizeof(string) instead of 32, ETHTOOL_BUSINFO_LEN and custom defines. Use snprintf instead of sprint. Remove unnecessary inits of ->fw_version Remove unnecessary inits of drvinfo struct. Signed-off-by: Jiri Pirko <jiri@resnulli.us> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:

committed by
David S. Miller

parent
2afb9b5334
commit
7826d43f2d
@@ -2179,10 +2179,10 @@ bdx_get_drvinfo(struct net_device *netdev, struct ethtool_drvinfo *drvinfo)
|
||||
{
|
||||
struct bdx_priv *priv = netdev_priv(netdev);
|
||||
|
||||
strlcat(drvinfo->driver, BDX_DRV_NAME, sizeof(drvinfo->driver));
|
||||
strlcat(drvinfo->version, BDX_DRV_VERSION, sizeof(drvinfo->version));
|
||||
strlcat(drvinfo->fw_version, "N/A", sizeof(drvinfo->fw_version));
|
||||
strlcat(drvinfo->bus_info, pci_name(priv->pdev),
|
||||
strlcpy(drvinfo->driver, BDX_DRV_NAME, sizeof(drvinfo->driver));
|
||||
strlcpy(drvinfo->version, BDX_DRV_VERSION, sizeof(drvinfo->version));
|
||||
strlcpy(drvinfo->fw_version, "N/A", sizeof(drvinfo->fw_version));
|
||||
strlcpy(drvinfo->bus_info, pci_name(priv->pdev),
|
||||
sizeof(drvinfo->bus_info));
|
||||
|
||||
drvinfo->n_stats = ((priv->stats_flag) ? ARRAY_SIZE(bdx_stat_names) : 0);
|
||||
|
Reference in New Issue
Block a user