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
@@ -2190,11 +2190,10 @@ static void emac_ethtool_get_drvinfo(struct net_device *ndev,
|
||||
{
|
||||
struct emac_instance *dev = netdev_priv(ndev);
|
||||
|
||||
strcpy(info->driver, "ibm_emac");
|
||||
strcpy(info->version, DRV_VERSION);
|
||||
info->fw_version[0] = '\0';
|
||||
sprintf(info->bus_info, "PPC 4xx EMAC-%d %s",
|
||||
dev->cell_index, dev->ofdev->dev.of_node->full_name);
|
||||
strlcpy(info->driver, "ibm_emac", sizeof(info->driver));
|
||||
strlcpy(info->version, DRV_VERSION, sizeof(info->version));
|
||||
snprintf(info->bus_info, sizeof(info->bus_info), "PPC 4xx EMAC-%d %s",
|
||||
dev->cell_index, dev->ofdev->dev.of_node->full_name);
|
||||
info->regdump_len = emac_ethtool_get_regs_len(ndev);
|
||||
}
|
||||
|
||||
|
||||
@@ -722,9 +722,8 @@ static int netdev_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
|
||||
static void netdev_get_drvinfo(struct net_device *dev,
|
||||
struct ethtool_drvinfo *info)
|
||||
{
|
||||
strncpy(info->driver, ibmveth_driver_name, sizeof(info->driver) - 1);
|
||||
strncpy(info->version, ibmveth_driver_version,
|
||||
sizeof(info->version) - 1);
|
||||
strlcpy(info->driver, ibmveth_driver_name, sizeof(info->driver));
|
||||
strlcpy(info->version, ibmveth_driver_version, sizeof(info->version));
|
||||
}
|
||||
|
||||
static netdev_features_t ibmveth_fix_features(struct net_device *dev,
|
||||
|
||||
Reference in New Issue
Block a user