aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/bonding/bond_main.c
diff options
context:
space:
mode:
authorJiri Pirko <jiri@resnulli.us>2013-01-05 19:44:26 -0500
committerDavid S. Miller <davem@davemloft.net>2013-01-07 00:06:31 -0500
commit7826d43f2db45c9305a6e0ba165650e1a203f517 (patch)
treea8659c995a37f58db809da9537aafac178431f31 /drivers/net/bonding/bond_main.c
parent2afb9b533423a9b97f84181e773cf9361d98fed6 (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/bonding/bond_main.c')
-rw-r--r--drivers/net/bonding/bond_main.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index c4952985c084..564cf4231f48 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -4330,11 +4330,12 @@ void bond_set_mode_ops(struct bonding *bond, int mode)
4330} 4330}
4331 4331
4332static void bond_ethtool_get_drvinfo(struct net_device *bond_dev, 4332static void bond_ethtool_get_drvinfo(struct net_device *bond_dev,
4333 struct ethtool_drvinfo *drvinfo) 4333 struct ethtool_drvinfo *drvinfo)
4334{ 4334{
4335 strncpy(drvinfo->driver, DRV_NAME, 32); 4335 strlcpy(drvinfo->driver, DRV_NAME, sizeof(drvinfo->driver));
4336 strncpy(drvinfo->version, DRV_VERSION, 32); 4336 strlcpy(drvinfo->version, DRV_VERSION, sizeof(drvinfo->version));
4337 snprintf(drvinfo->fw_version, 32, "%d", BOND_ABI_VERSION); 4337 snprintf(drvinfo->fw_version, sizeof(drvinfo->fw_version), "%d",
4338 BOND_ABI_VERSION);
4338} 4339}
4339 4340
4340static const struct ethtool_ops bond_ethtool_ops = { 4341static const struct ethtool_ops bond_ethtool_ops = {