aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/emulex
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/ethernet/emulex
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/ethernet/emulex')
-rw-r--r--drivers/net/ethernet/emulex/benet/be_ethtool.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/drivers/net/ethernet/emulex/benet/be_ethtool.c b/drivers/net/ethernet/emulex/benet/be_ethtool.c
index 00454a10f88d..76b302f30c87 100644
--- a/drivers/net/ethernet/emulex/benet/be_ethtool.c
+++ b/drivers/net/ethernet/emulex/benet/be_ethtool.c
@@ -183,12 +183,12 @@ static void be_get_drvinfo(struct net_device *netdev,
183 183
184 strlcpy(drvinfo->driver, DRV_NAME, sizeof(drvinfo->driver)); 184 strlcpy(drvinfo->driver, DRV_NAME, sizeof(drvinfo->driver));
185 strlcpy(drvinfo->version, DRV_VER, sizeof(drvinfo->version)); 185 strlcpy(drvinfo->version, DRV_VER, sizeof(drvinfo->version));
186 strncpy(drvinfo->fw_version, adapter->fw_ver, FW_VER_LEN); 186 if (!memcmp(adapter->fw_ver, fw_on_flash, FW_VER_LEN))
187 if (memcmp(adapter->fw_ver, fw_on_flash, FW_VER_LEN) != 0) { 187 strlcpy(drvinfo->fw_version, adapter->fw_ver,
188 strcat(drvinfo->fw_version, " ["); 188 sizeof(drvinfo->fw_version));
189 strcat(drvinfo->fw_version, fw_on_flash); 189 else
190 strcat(drvinfo->fw_version, "]"); 190 snprintf(drvinfo->fw_version, sizeof(drvinfo->fw_version),
191 } 191 "%s [%s]", adapter->fw_ver, fw_on_flash);
192 192
193 strlcpy(drvinfo->bus_info, pci_name(adapter->pdev), 193 strlcpy(drvinfo->bus_info, pci_name(adapter->pdev),
194 sizeof(drvinfo->bus_info)); 194 sizeof(drvinfo->bus_info));