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/3com | |
| 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/3com')
| -rw-r--r-- | drivers/net/ethernet/3com/3c501.c | 7 | ||||
| -rw-r--r-- | drivers/net/ethernet/3com/3c509.c | 4 | ||||
| -rw-r--r-- | drivers/net/ethernet/3com/3c515.c | 7 |
3 files changed, 10 insertions, 8 deletions
diff --git a/drivers/net/ethernet/3com/3c501.c b/drivers/net/ethernet/3com/3c501.c index 2038eaabaea4..9abd9a738f8e 100644 --- a/drivers/net/ethernet/3com/3c501.c +++ b/drivers/net/ethernet/3com/3c501.c | |||
| @@ -823,9 +823,10 @@ static void set_multicast_list(struct net_device *dev) | |||
| 823 | static void netdev_get_drvinfo(struct net_device *dev, | 823 | static void netdev_get_drvinfo(struct net_device *dev, |
| 824 | struct ethtool_drvinfo *info) | 824 | struct ethtool_drvinfo *info) |
| 825 | { | 825 | { |
| 826 | strcpy(info->driver, DRV_NAME); | 826 | strlcpy(info->driver, DRV_NAME, sizeof(info->driver)); |
| 827 | strcpy(info->version, DRV_VERSION); | 827 | strlcpy(info->version, DRV_VERSION, sizeof(info->version)); |
| 828 | sprintf(info->bus_info, "ISA 0x%lx", dev->base_addr); | 828 | snprintf(info->bus_info, sizeof(info->bus_info), "ISA 0x%lx", |
| 829 | dev->base_addr); | ||
| 829 | } | 830 | } |
| 830 | 831 | ||
| 831 | static u32 netdev_get_msglevel(struct net_device *dev) | 832 | static u32 netdev_get_msglevel(struct net_device *dev) |
diff --git a/drivers/net/ethernet/3com/3c509.c b/drivers/net/ethernet/3com/3c509.c index 633c709b9d99..f36ff99fd394 100644 --- a/drivers/net/ethernet/3com/3c509.c +++ b/drivers/net/ethernet/3com/3c509.c | |||
| @@ -1161,8 +1161,8 @@ el3_netdev_set_ecmd(struct net_device *dev, struct ethtool_cmd *ecmd) | |||
| 1161 | 1161 | ||
| 1162 | static void el3_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info) | 1162 | static void el3_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info) |
| 1163 | { | 1163 | { |
| 1164 | strcpy(info->driver, DRV_NAME); | 1164 | strlcpy(info->driver, DRV_NAME, sizeof(info->driver)); |
| 1165 | strcpy(info->version, DRV_VERSION); | 1165 | strlcpy(info->version, DRV_VERSION, sizeof(info->version)); |
| 1166 | } | 1166 | } |
| 1167 | 1167 | ||
| 1168 | static int el3_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd) | 1168 | static int el3_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd) |
diff --git a/drivers/net/ethernet/3com/3c515.c b/drivers/net/ethernet/3com/3c515.c index 59e1e001bc3f..94c656f5a05d 100644 --- a/drivers/net/ethernet/3com/3c515.c +++ b/drivers/net/ethernet/3com/3c515.c | |||
| @@ -1542,9 +1542,10 @@ static void set_rx_mode(struct net_device *dev) | |||
| 1542 | static void netdev_get_drvinfo(struct net_device *dev, | 1542 | static void netdev_get_drvinfo(struct net_device *dev, |
| 1543 | struct ethtool_drvinfo *info) | 1543 | struct ethtool_drvinfo *info) |
| 1544 | { | 1544 | { |
| 1545 | strcpy(info->driver, DRV_NAME); | 1545 | strlcpy(info->driver, DRV_NAME, sizeof(info->driver)); |
| 1546 | strcpy(info->version, DRV_VERSION); | 1546 | strlcpy(info->version, DRV_VERSION, sizeof(info->version)); |
| 1547 | sprintf(info->bus_info, "ISA 0x%lx", dev->base_addr); | 1547 | snprintf(info->bus_info, sizeof(info->bus_info), "ISA 0x%lx", |
| 1548 | dev->base_addr); | ||
| 1548 | } | 1549 | } |
| 1549 | 1550 | ||
| 1550 | static u32 netdev_get_msglevel(struct net_device *dev) | 1551 | static u32 netdev_get_msglevel(struct net_device *dev) |
