diff options
author | Jiri Pirko <jiri@resnulli.us> | 2013-01-05 19:44:26 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-01-07 00:06:31 -0500 |
commit | 7826d43f2db45c9305a6e0ba165650e1a203f517 (patch) | |
tree | a8659c995a37f58db809da9537aafac178431f31 /drivers/net/ethernet/xscale | |
parent | 2afb9b533423a9b97f84181e773cf9361d98fed6 (diff) |
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>
Diffstat (limited to 'drivers/net/ethernet/xscale')
-rw-r--r-- | drivers/net/ethernet/xscale/ixp4xx_eth.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/net/ethernet/xscale/ixp4xx_eth.c b/drivers/net/ethernet/xscale/ixp4xx_eth.c index d3ebb73277be..a4be1ad886c5 100644 --- a/drivers/net/ethernet/xscale/ixp4xx_eth.c +++ b/drivers/net/ethernet/xscale/ixp4xx_eth.c | |||
@@ -977,11 +977,12 @@ static void ixp4xx_get_drvinfo(struct net_device *dev, | |||
977 | struct ethtool_drvinfo *info) | 977 | struct ethtool_drvinfo *info) |
978 | { | 978 | { |
979 | struct port *port = netdev_priv(dev); | 979 | struct port *port = netdev_priv(dev); |
980 | strcpy(info->driver, DRV_NAME); | 980 | |
981 | strlcpy(info->driver, DRV_NAME, sizeof(info->driver)); | ||
981 | snprintf(info->fw_version, sizeof(info->fw_version), "%u:%u:%u:%u", | 982 | snprintf(info->fw_version, sizeof(info->fw_version), "%u:%u:%u:%u", |
982 | port->firmware[0], port->firmware[1], | 983 | port->firmware[0], port->firmware[1], |
983 | port->firmware[2], port->firmware[3]); | 984 | port->firmware[2], port->firmware[3]); |
984 | strcpy(info->bus_info, "internal"); | 985 | strlcpy(info->bus_info, "internal", sizeof(info->bus_info)); |
985 | } | 986 | } |
986 | 987 | ||
987 | static int ixp4xx_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) | 988 | static int ixp4xx_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) |