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/infiniband/hw/nes | |
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/infiniband/hw/nes')
-rw-r--r-- | drivers/infiniband/hw/nes/nes_nic.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/drivers/infiniband/hw/nes/nes_nic.c b/drivers/infiniband/hw/nes/nes_nic.c index 9542e1644a5c..177cf7664726 100644 --- a/drivers/infiniband/hw/nes/nes_nic.c +++ b/drivers/infiniband/hw/nes/nes_nic.c | |||
@@ -1317,11 +1317,13 @@ static void nes_netdev_get_drvinfo(struct net_device *netdev, | |||
1317 | struct nes_vnic *nesvnic = netdev_priv(netdev); | 1317 | struct nes_vnic *nesvnic = netdev_priv(netdev); |
1318 | struct nes_adapter *nesadapter = nesvnic->nesdev->nesadapter; | 1318 | struct nes_adapter *nesadapter = nesvnic->nesdev->nesadapter; |
1319 | 1319 | ||
1320 | strcpy(drvinfo->driver, DRV_NAME); | 1320 | strlcpy(drvinfo->driver, DRV_NAME, sizeof(drvinfo->driver)); |
1321 | strcpy(drvinfo->bus_info, pci_name(nesvnic->nesdev->pcidev)); | 1321 | strlcpy(drvinfo->bus_info, pci_name(nesvnic->nesdev->pcidev), |
1322 | sprintf(drvinfo->fw_version, "%u.%u", nesadapter->firmware_version>>16, | 1322 | sizeof(drvinfo->bus_info)); |
1323 | nesadapter->firmware_version & 0x000000ff); | 1323 | snprintf(drvinfo->fw_version, sizeof(drvinfo->fw_version), |
1324 | strcpy(drvinfo->version, DRV_VERSION); | 1324 | "%u.%u", nesadapter->firmware_version >> 16, |
1325 | nesadapter->firmware_version & 0x000000ff); | ||
1326 | strlcpy(drvinfo->version, DRV_VERSION, sizeof(drvinfo->version)); | ||
1325 | drvinfo->testinfo_len = 0; | 1327 | drvinfo->testinfo_len = 0; |
1326 | drvinfo->eedump_len = 0; | 1328 | drvinfo->eedump_len = 0; |
1327 | drvinfo->regdump_len = 0; | 1329 | drvinfo->regdump_len = 0; |