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/wimax/i2400m/netdev.c | |
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/wimax/i2400m/netdev.c')
-rw-r--r-- | drivers/net/wimax/i2400m/netdev.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/drivers/net/wimax/i2400m/netdev.c b/drivers/net/wimax/i2400m/netdev.c index 1d76ae855f07..cedd4d30d996 100644 --- a/drivers/net/wimax/i2400m/netdev.c +++ b/drivers/net/wimax/i2400m/netdev.c | |||
@@ -596,12 +596,12 @@ static void i2400m_get_drvinfo(struct net_device *net_dev, | |||
596 | { | 596 | { |
597 | struct i2400m *i2400m = net_dev_to_i2400m(net_dev); | 597 | struct i2400m *i2400m = net_dev_to_i2400m(net_dev); |
598 | 598 | ||
599 | strncpy(info->driver, KBUILD_MODNAME, sizeof(info->driver) - 1); | 599 | strlcpy(info->driver, KBUILD_MODNAME, sizeof(info->driver)); |
600 | strncpy(info->fw_version, | 600 | strlcpy(info->fw_version, i2400m->fw_name ? : "", |
601 | i2400m->fw_name ? : "", sizeof(info->fw_version) - 1); | 601 | sizeof(info->fw_version)); |
602 | if (net_dev->dev.parent) | 602 | if (net_dev->dev.parent) |
603 | strncpy(info->bus_info, dev_name(net_dev->dev.parent), | 603 | strlcpy(info->bus_info, dev_name(net_dev->dev.parent), |
604 | sizeof(info->bus_info) - 1); | 604 | sizeof(info->bus_info)); |
605 | } | 605 | } |
606 | 606 | ||
607 | static const struct ethtool_ops i2400m_ethtool_ops = { | 607 | static const struct ethtool_ops i2400m_ethtool_ops = { |