Commit 7826d43f2db45c9305a6e0ba165650e1a203f517
Committed by
David S. Miller
1 parent
2afb9b5334
Exists in
smarc-l5.0.0_1.0.0-ga
and in
5 other branches
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>
Showing 86 changed files with 297 additions and 277 deletions Side-by-side Diff
- arch/um/drivers/net_kern.c
- drivers/infiniband/hw/nes/nes_nic.c
- drivers/infiniband/ulp/ipoib/ipoib_ethtool.c
- drivers/net/bonding/bond_main.c
- drivers/net/cris/eth_v10.c
- drivers/net/ethernet/3com/3c501.c
- drivers/net/ethernet/3com/3c509.c
- drivers/net/ethernet/3com/3c515.c
- drivers/net/ethernet/8390/3c503.c
- drivers/net/ethernet/8390/ax88796.c
- drivers/net/ethernet/adi/bfin_mac.c
- drivers/net/ethernet/aeroflex/greth.c
- drivers/net/ethernet/amd/au1000_eth.c
- drivers/net/ethernet/amd/sunlance.c
- drivers/net/ethernet/broadcom/bcm63xx_enet.c
- drivers/net/ethernet/cirrus/ep93xx_eth.c
- drivers/net/ethernet/davicom/dm9000.c
- drivers/net/ethernet/dec/ewrk3.c
- drivers/net/ethernet/dlink/dl2k.c
- drivers/net/ethernet/emulex/benet/be_ethtool.c
- drivers/net/ethernet/faraday/ftgmac100.c
- drivers/net/ethernet/faraday/ftmac100.c
- drivers/net/ethernet/freescale/fec.c
- drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c
- drivers/net/ethernet/freescale/gianfar.h
- drivers/net/ethernet/freescale/gianfar_ethtool.c
- drivers/net/ethernet/freescale/ucc_geth_ethtool.c
- drivers/net/ethernet/i825xx/3c505.c
- drivers/net/ethernet/i825xx/3c507.c
- drivers/net/ethernet/ibm/emac/core.c
- drivers/net/ethernet/ibm/ibmveth.c
- drivers/net/ethernet/korina.c
- drivers/net/ethernet/lantiq_etop.c
- drivers/net/ethernet/marvell/pxa168_eth.c
- drivers/net/ethernet/neterion/vxge/vxge-ethtool.c
- drivers/net/ethernet/nuvoton/w90p910_ether.c
- drivers/net/ethernet/nxp/lpc_eth.c
- drivers/net/ethernet/octeon/octeon_mgmt.c
- drivers/net/ethernet/packetengines/hamachi.c
- drivers/net/ethernet/packetengines/yellowfin.c
- drivers/net/ethernet/rdc/r6040.c
- drivers/net/ethernet/sgi/ioc3-eth.c
- drivers/net/ethernet/smsc/smc911x.c
- drivers/net/ethernet/smsc/smc91x.c
- drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c
- drivers/net/ethernet/sun/sunbmac.c
- drivers/net/ethernet/sun/sunqe.c
- drivers/net/ethernet/sun/sunvnet.c
- drivers/net/ethernet/tehuti/tehuti.c
- drivers/net/ethernet/ti/cpmac.c
- drivers/net/ethernet/ti/cpsw.c
- drivers/net/ethernet/ti/davinci_emac.c
- drivers/net/ethernet/toshiba/ps3_gelic_net.c
- drivers/net/ethernet/toshiba/spider_net_ethtool.c
- drivers/net/ethernet/toshiba/tc35815.c
- drivers/net/ethernet/xilinx/xilinx_axienet_main.c
- drivers/net/ethernet/xircom/xirc2ps_cs.c
- drivers/net/ethernet/xscale/ixp4xx_eth.c
- drivers/net/hyperv/netvsc_drv.c
- drivers/net/macvlan.c
- drivers/net/rionet.c
- drivers/net/usb/asix_common.c
- drivers/net/usb/catc.c
- drivers/net/usb/cdc_ncm.c
- drivers/net/usb/pegasus.c
- drivers/net/usb/rtl8150.c
- drivers/net/usb/sierra_net.c
- drivers/net/vmxnet3/vmxnet3_ethtool.c
- drivers/net/wimax/i2400m/netdev.c
- drivers/net/wimax/i2400m/usb.c
- drivers/net/wireless/brcm80211/brcmfmac/dhd_linux.c
- drivers/s390/net/qeth_core_main.c
- drivers/staging/bcm/Bcmnet.c
- drivers/staging/ccg/u_ether.c
- drivers/staging/et131x/et131x.c
- drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c
- drivers/staging/octeon/ethernet-mdio.c
- drivers/staging/rtl8192e/rtl8192e/rtl_ethtool.c
- drivers/staging/wlags49_h2/wl_netdev.c
- drivers/usb/gadget/u_ether.c
- net/8021q/vlan_dev.c
- net/batman-adv/soft-interface.c
- net/bridge/br_device.c
- net/dsa/slave.c
- net/openvswitch/vport-internal_dev.c
- net/wireless/ethtool.c
arch/um/drivers/net_kern.c
... | ... | @@ -274,8 +274,8 @@ |
274 | 274 | static void uml_net_get_drvinfo(struct net_device *dev, |
275 | 275 | struct ethtool_drvinfo *info) |
276 | 276 | { |
277 | - strcpy(info->driver, DRIVER_NAME); | |
278 | - strcpy(info->version, "42"); | |
277 | + strlcpy(info->driver, DRIVER_NAME, sizeof(info->driver)); | |
278 | + strlcpy(info->version, "42", sizeof(info->version)); | |
279 | 279 | } |
280 | 280 | |
281 | 281 | static const struct ethtool_ops uml_net_ethtool_ops = { |
drivers/infiniband/hw/nes/nes_nic.c
... | ... | @@ -1317,11 +1317,13 @@ |
1317 | 1317 | struct nes_vnic *nesvnic = netdev_priv(netdev); |
1318 | 1318 | struct nes_adapter *nesadapter = nesvnic->nesdev->nesadapter; |
1319 | 1319 | |
1320 | - strcpy(drvinfo->driver, DRV_NAME); | |
1321 | - strcpy(drvinfo->bus_info, pci_name(nesvnic->nesdev->pcidev)); | |
1322 | - sprintf(drvinfo->fw_version, "%u.%u", nesadapter->firmware_version>>16, | |
1323 | - nesadapter->firmware_version & 0x000000ff); | |
1324 | - strcpy(drvinfo->version, DRV_VERSION); | |
1320 | + strlcpy(drvinfo->driver, DRV_NAME, sizeof(drvinfo->driver)); | |
1321 | + strlcpy(drvinfo->bus_info, pci_name(nesvnic->nesdev->pcidev), | |
1322 | + sizeof(drvinfo->bus_info)); | |
1323 | + snprintf(drvinfo->fw_version, sizeof(drvinfo->fw_version), | |
1324 | + "%u.%u", nesadapter->firmware_version >> 16, | |
1325 | + nesadapter->firmware_version & 0x000000ff); | |
1326 | + strlcpy(drvinfo->version, DRV_VERSION, sizeof(drvinfo->version)); | |
1325 | 1327 | drvinfo->testinfo_len = 0; |
1326 | 1328 | drvinfo->eedump_len = 0; |
1327 | 1329 | drvinfo->regdump_len = 0; |
drivers/infiniband/ulp/ipoib/ipoib_ethtool.c
... | ... | @@ -39,7 +39,7 @@ |
39 | 39 | static void ipoib_get_drvinfo(struct net_device *netdev, |
40 | 40 | struct ethtool_drvinfo *drvinfo) |
41 | 41 | { |
42 | - strncpy(drvinfo->driver, "ipoib", sizeof(drvinfo->driver) - 1); | |
42 | + strlcpy(drvinfo->driver, "ipoib", sizeof(drvinfo->driver)); | |
43 | 43 | } |
44 | 44 | |
45 | 45 | static int ipoib_get_coalesce(struct net_device *dev, |
drivers/net/bonding/bond_main.c
... | ... | @@ -4330,11 +4330,12 @@ |
4330 | 4330 | } |
4331 | 4331 | |
4332 | 4332 | static 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); | |
4336 | - strncpy(drvinfo->version, DRV_VERSION, 32); | |
4337 | - snprintf(drvinfo->fw_version, 32, "%d", BOND_ABI_VERSION); | |
4335 | + strlcpy(drvinfo->driver, DRV_NAME, sizeof(drvinfo->driver)); | |
4336 | + strlcpy(drvinfo->version, DRV_VERSION, sizeof(drvinfo->version)); | |
4337 | + snprintf(drvinfo->fw_version, sizeof(drvinfo->fw_version), "%d", | |
4338 | + BOND_ABI_VERSION); | |
4338 | 4339 | } |
4339 | 4340 | |
4340 | 4341 | static const struct ethtool_ops bond_ethtool_ops = { |
drivers/net/cris/eth_v10.c
... | ... | @@ -1448,10 +1448,10 @@ |
1448 | 1448 | static void e100_get_drvinfo(struct net_device *dev, |
1449 | 1449 | struct ethtool_drvinfo *info) |
1450 | 1450 | { |
1451 | - strncpy(info->driver, "ETRAX 100LX", sizeof(info->driver) - 1); | |
1452 | - strncpy(info->version, "$Revision: 1.31 $", sizeof(info->version) - 1); | |
1453 | - strncpy(info->fw_version, "N/A", sizeof(info->fw_version) - 1); | |
1454 | - strncpy(info->bus_info, "N/A", sizeof(info->bus_info) - 1); | |
1451 | + strlcpy(info->driver, "ETRAX 100LX", sizeof(info->driver)); | |
1452 | + strlcpy(info->version, "$Revision: 1.31 $", sizeof(info->version)); | |
1453 | + strlcpy(info->fw_version, "N/A", sizeof(info->fw_version)); | |
1454 | + strlcpy(info->bus_info, "N/A", sizeof(info->bus_info)); | |
1455 | 1455 | } |
1456 | 1456 | |
1457 | 1457 | static int e100_nway_reset(struct net_device *dev) |
drivers/net/ethernet/3com/3c501.c
... | ... | @@ -823,9 +823,10 @@ |
823 | 823 | static void netdev_get_drvinfo(struct net_device *dev, |
824 | 824 | struct ethtool_drvinfo *info) |
825 | 825 | { |
826 | - strcpy(info->driver, DRV_NAME); | |
827 | - strcpy(info->version, DRV_VERSION); | |
828 | - sprintf(info->bus_info, "ISA 0x%lx", dev->base_addr); | |
826 | + strlcpy(info->driver, DRV_NAME, sizeof(info->driver)); | |
827 | + strlcpy(info->version, DRV_VERSION, sizeof(info->version)); | |
828 | + snprintf(info->bus_info, sizeof(info->bus_info), "ISA 0x%lx", | |
829 | + dev->base_addr); | |
829 | 830 | } |
830 | 831 | |
831 | 832 | static u32 netdev_get_msglevel(struct net_device *dev) |
drivers/net/ethernet/3com/3c509.c
... | ... | @@ -1161,8 +1161,8 @@ |
1161 | 1161 | |
1162 | 1162 | static void el3_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info) |
1163 | 1163 | { |
1164 | - strcpy(info->driver, DRV_NAME); | |
1165 | - strcpy(info->version, DRV_VERSION); | |
1164 | + strlcpy(info->driver, DRV_NAME, sizeof(info->driver)); | |
1165 | + strlcpy(info->version, DRV_VERSION, sizeof(info->version)); | |
1166 | 1166 | } |
1167 | 1167 | |
1168 | 1168 | static int el3_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd) |
drivers/net/ethernet/3com/3c515.c
... | ... | @@ -1542,9 +1542,10 @@ |
1542 | 1542 | static void netdev_get_drvinfo(struct net_device *dev, |
1543 | 1543 | struct ethtool_drvinfo *info) |
1544 | 1544 | { |
1545 | - strcpy(info->driver, DRV_NAME); | |
1546 | - strcpy(info->version, DRV_VERSION); | |
1547 | - sprintf(info->bus_info, "ISA 0x%lx", dev->base_addr); | |
1545 | + strlcpy(info->driver, DRV_NAME, sizeof(info->driver)); | |
1546 | + strlcpy(info->version, DRV_VERSION, sizeof(info->version)); | |
1547 | + snprintf(info->bus_info, sizeof(info->bus_info), "ISA 0x%lx", | |
1548 | + dev->base_addr); | |
1548 | 1549 | } |
1549 | 1550 | |
1550 | 1551 | static u32 netdev_get_msglevel(struct net_device *dev) |
drivers/net/ethernet/8390/3c503.c
... | ... | @@ -695,9 +695,10 @@ |
695 | 695 | static void netdev_get_drvinfo(struct net_device *dev, |
696 | 696 | struct ethtool_drvinfo *info) |
697 | 697 | { |
698 | - strcpy(info->driver, DRV_NAME); | |
699 | - strcpy(info->version, DRV_VERSION); | |
700 | - sprintf(info->bus_info, "ISA 0x%lx", dev->base_addr); | |
698 | + strlcpy(info->driver, DRV_NAME, sizeof(info->driver)); | |
699 | + strlcpy(info->version, DRV_VERSION, sizeof(info->version)); | |
700 | + snprintf(info->bus_info, sizeof(info->bus_info), "ISA 0x%lx", | |
701 | + dev->base_addr); | |
701 | 702 | } |
702 | 703 | |
703 | 704 | static const struct ethtool_ops netdev_ethtool_ops = { |
drivers/net/ethernet/8390/ax88796.c
... | ... | @@ -469,9 +469,9 @@ |
469 | 469 | { |
470 | 470 | struct platform_device *pdev = to_platform_device(dev->dev.parent); |
471 | 471 | |
472 | - strcpy(info->driver, DRV_NAME); | |
473 | - strcpy(info->version, DRV_VERSION); | |
474 | - strcpy(info->bus_info, pdev->name); | |
472 | + strlcpy(info->driver, DRV_NAME, sizeof(info->driver)); | |
473 | + strlcpy(info->version, DRV_VERSION, sizeof(info->version)); | |
474 | + strlcpy(info->bus_info, pdev->name, sizeof(info->bus_info)); | |
475 | 475 | } |
476 | 476 | |
477 | 477 | static int ax_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) |
drivers/net/ethernet/adi/bfin_mac.c
... | ... | @@ -498,10 +498,10 @@ |
498 | 498 | static void bfin_mac_ethtool_getdrvinfo(struct net_device *dev, |
499 | 499 | struct ethtool_drvinfo *info) |
500 | 500 | { |
501 | - strcpy(info->driver, KBUILD_MODNAME); | |
502 | - strcpy(info->version, DRV_VERSION); | |
503 | - strcpy(info->fw_version, "N/A"); | |
504 | - strcpy(info->bus_info, dev_name(&dev->dev)); | |
501 | + strlcpy(info->driver, KBUILD_MODNAME, sizeof(info->driver)); | |
502 | + strlcpy(info->version, DRV_VERSION, sizeof(info->version)); | |
503 | + strlcpy(info->fw_version, "N/A", sizeof(info->fw_version)); | |
504 | + strlcpy(info->bus_info, dev_name(&dev->dev), sizeof(info->bus_info)); | |
505 | 505 | } |
506 | 506 | |
507 | 507 | static void bfin_mac_ethtool_getwol(struct net_device *dev, |
drivers/net/ethernet/aeroflex/greth.c
... | ... | @@ -1127,10 +1127,11 @@ |
1127 | 1127 | { |
1128 | 1128 | struct greth_private *greth = netdev_priv(dev); |
1129 | 1129 | |
1130 | - strncpy(info->driver, dev_driver_string(greth->dev), 32); | |
1131 | - strncpy(info->version, "revision: 1.0", 32); | |
1132 | - strncpy(info->bus_info, greth->dev->bus->name, 32); | |
1133 | - strncpy(info->fw_version, "N/A", 32); | |
1130 | + strlcpy(info->driver, dev_driver_string(greth->dev), | |
1131 | + sizeof(info->driver)); | |
1132 | + strlcpy(info->version, "revision: 1.0", sizeof(info->version)); | |
1133 | + strlcpy(info->bus_info, greth->dev->bus->name, sizeof(info->bus_info)); | |
1134 | + strlcpy(info->fw_version, "N/A", sizeof(info->fw_version)); | |
1134 | 1135 | info->eedump_len = 0; |
1135 | 1136 | info->regdump_len = sizeof(struct greth_regs); |
1136 | 1137 | } |
drivers/net/ethernet/amd/au1000_eth.c
... | ... | @@ -587,10 +587,10 @@ |
587 | 587 | { |
588 | 588 | struct au1000_private *aup = netdev_priv(dev); |
589 | 589 | |
590 | - strcpy(info->driver, DRV_NAME); | |
591 | - strcpy(info->version, DRV_VERSION); | |
592 | - info->fw_version[0] = '\0'; | |
593 | - sprintf(info->bus_info, "%s %d", DRV_NAME, aup->mac_id); | |
590 | + strlcpy(info->driver, DRV_NAME, sizeof(info->driver)); | |
591 | + strlcpy(info->version, DRV_VERSION, sizeof(info->version)); | |
592 | + snprintf(info->bus_info, sizeof(info->bus_info), "%s %d", DRV_NAME, | |
593 | + aup->mac_id); | |
594 | 594 | info->regdump_len = 0; |
595 | 595 | } |
596 | 596 |
drivers/net/ethernet/amd/sunlance.c
... | ... | @@ -1284,8 +1284,8 @@ |
1284 | 1284 | /* Ethtool support... */ |
1285 | 1285 | static void sparc_lance_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info) |
1286 | 1286 | { |
1287 | - strcpy(info->driver, "sunlance"); | |
1288 | - strcpy(info->version, "2.02"); | |
1287 | + strlcpy(info->driver, "sunlance", sizeof(info->driver)); | |
1288 | + strlcpy(info->version, "2.02", sizeof(info->version)); | |
1289 | 1289 | } |
1290 | 1290 | |
1291 | 1291 | static const struct ethtool_ops sparc_lance_ethtool_ops = { |
drivers/net/ethernet/broadcom/bcm63xx_enet.c
... | ... | @@ -1227,10 +1227,11 @@ |
1227 | 1227 | static void bcm_enet_get_drvinfo(struct net_device *netdev, |
1228 | 1228 | struct ethtool_drvinfo *drvinfo) |
1229 | 1229 | { |
1230 | - strncpy(drvinfo->driver, bcm_enet_driver_name, 32); | |
1231 | - strncpy(drvinfo->version, bcm_enet_driver_version, 32); | |
1232 | - strncpy(drvinfo->fw_version, "N/A", 32); | |
1233 | - strncpy(drvinfo->bus_info, "bcm63xx", 32); | |
1230 | + strlcpy(drvinfo->driver, bcm_enet_driver_name, sizeof(drvinfo->driver)); | |
1231 | + strlcpy(drvinfo->version, bcm_enet_driver_version, | |
1232 | + sizeof(drvinfo->version)); | |
1233 | + strlcpy(drvinfo->fw_version, "N/A", sizeof(drvinfo->fw_version)); | |
1234 | + strlcpy(drvinfo->bus_info, "bcm63xx", sizeof(drvinfo->bus_info)); | |
1234 | 1235 | drvinfo->n_stats = BCM_ENET_STATS_LEN; |
1235 | 1236 | } |
1236 | 1237 |
drivers/net/ethernet/cirrus/ep93xx_eth.c
... | ... | @@ -710,8 +710,8 @@ |
710 | 710 | |
711 | 711 | static void ep93xx_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info) |
712 | 712 | { |
713 | - strcpy(info->driver, DRV_MODULE_NAME); | |
714 | - strcpy(info->version, DRV_MODULE_VERSION); | |
713 | + strlcpy(info->driver, DRV_MODULE_NAME, sizeof(info->driver)); | |
714 | + strlcpy(info->version, DRV_MODULE_VERSION, sizeof(info->version)); | |
715 | 715 | } |
716 | 716 | |
717 | 717 | static int ep93xx_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) |
drivers/net/ethernet/davicom/dm9000.c
... | ... | @@ -434,9 +434,10 @@ |
434 | 434 | { |
435 | 435 | board_info_t *dm = to_dm9000_board(dev); |
436 | 436 | |
437 | - strcpy(info->driver, CARDNAME); | |
438 | - strcpy(info->version, DRV_VERSION); | |
439 | - strcpy(info->bus_info, to_platform_device(dm->dev)->name); | |
437 | + strlcpy(info->driver, CARDNAME, sizeof(info->driver)); | |
438 | + strlcpy(info->version, DRV_VERSION, sizeof(info->version)); | |
439 | + strlcpy(info->bus_info, to_platform_device(dm->dev)->name, | |
440 | + sizeof(info->bus_info)); | |
440 | 441 | } |
441 | 442 | |
442 | 443 | static u32 dm9000_get_msglevel(struct net_device *dev) |
drivers/net/ethernet/dec/ewrk3.c
... | ... | @@ -1506,10 +1506,10 @@ |
1506 | 1506 | { |
1507 | 1507 | int fwrev = Read_EEPROM(dev->base_addr, EEPROM_REVLVL); |
1508 | 1508 | |
1509 | - strcpy(info->driver, DRV_NAME); | |
1510 | - strcpy(info->version, DRV_VERSION); | |
1511 | - sprintf(info->fw_version, "%d", fwrev); | |
1512 | - strcpy(info->bus_info, "N/A"); | |
1509 | + strlcpy(info->driver, DRV_NAME, sizeof(info->driver)); | |
1510 | + strlcpy(info->version, DRV_VERSION, sizeof(info->version)); | |
1511 | + snprintf(info->fw_version, sizeof(info->fw_version), "%d", fwrev); | |
1512 | + strlcpy(info->bus_info, "N/A", sizeof(info->bus_info)); | |
1513 | 1513 | info->eedump_len = EEPROM_MAX; |
1514 | 1514 | } |
1515 | 1515 |
drivers/net/ethernet/dlink/dl2k.c
... | ... | @@ -1156,9 +1156,10 @@ |
1156 | 1156 | static void rio_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info) |
1157 | 1157 | { |
1158 | 1158 | struct netdev_private *np = netdev_priv(dev); |
1159 | - strcpy(info->driver, "dl2k"); | |
1160 | - strcpy(info->version, DRV_VERSION); | |
1161 | - strcpy(info->bus_info, pci_name(np->pdev)); | |
1159 | + | |
1160 | + strlcpy(info->driver, "dl2k", sizeof(info->driver)); | |
1161 | + strlcpy(info->version, DRV_VERSION, sizeof(info->version)); | |
1162 | + strlcpy(info->bus_info, pci_name(np->pdev), sizeof(info->bus_info)); | |
1162 | 1163 | } |
1163 | 1164 | |
1164 | 1165 | static int rio_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) |
drivers/net/ethernet/emulex/benet/be_ethtool.c
... | ... | @@ -183,12 +183,12 @@ |
183 | 183 | |
184 | 184 | strlcpy(drvinfo->driver, DRV_NAME, sizeof(drvinfo->driver)); |
185 | 185 | strlcpy(drvinfo->version, DRV_VER, sizeof(drvinfo->version)); |
186 | - strncpy(drvinfo->fw_version, adapter->fw_ver, FW_VER_LEN); | |
187 | - if (memcmp(adapter->fw_ver, fw_on_flash, FW_VER_LEN) != 0) { | |
188 | - strcat(drvinfo->fw_version, " ["); | |
189 | - strcat(drvinfo->fw_version, fw_on_flash); | |
190 | - strcat(drvinfo->fw_version, "]"); | |
191 | - } | |
186 | + if (!memcmp(adapter->fw_ver, fw_on_flash, FW_VER_LEN)) | |
187 | + strlcpy(drvinfo->fw_version, adapter->fw_ver, | |
188 | + sizeof(drvinfo->fw_version)); | |
189 | + else | |
190 | + snprintf(drvinfo->fw_version, sizeof(drvinfo->fw_version), | |
191 | + "%s [%s]", adapter->fw_ver, fw_on_flash); | |
192 | 192 | |
193 | 193 | strlcpy(drvinfo->bus_info, pci_name(adapter->pdev), |
194 | 194 | sizeof(drvinfo->bus_info)); |
drivers/net/ethernet/faraday/ftgmac100.c
... | ... | @@ -955,9 +955,9 @@ |
955 | 955 | static void ftgmac100_get_drvinfo(struct net_device *netdev, |
956 | 956 | struct ethtool_drvinfo *info) |
957 | 957 | { |
958 | - strcpy(info->driver, DRV_NAME); | |
959 | - strcpy(info->version, DRV_VERSION); | |
960 | - strcpy(info->bus_info, dev_name(&netdev->dev)); | |
958 | + strlcpy(info->driver, DRV_NAME, sizeof(info->driver)); | |
959 | + strlcpy(info->version, DRV_VERSION, sizeof(info->version)); | |
960 | + strlcpy(info->bus_info, dev_name(&netdev->dev), sizeof(info->bus_info)); | |
961 | 961 | } |
962 | 962 | |
963 | 963 | static int ftgmac100_get_settings(struct net_device *netdev, |
drivers/net/ethernet/faraday/ftmac100.c
... | ... | @@ -820,9 +820,9 @@ |
820 | 820 | static void ftmac100_get_drvinfo(struct net_device *netdev, |
821 | 821 | struct ethtool_drvinfo *info) |
822 | 822 | { |
823 | - strcpy(info->driver, DRV_NAME); | |
824 | - strcpy(info->version, DRV_VERSION); | |
825 | - strcpy(info->bus_info, dev_name(&netdev->dev)); | |
823 | + strlcpy(info->driver, DRV_NAME, sizeof(info->driver)); | |
824 | + strlcpy(info->version, DRV_VERSION, sizeof(info->version)); | |
825 | + strlcpy(info->bus_info, dev_name(&netdev->dev), sizeof(info->bus_info)); | |
826 | 826 | } |
827 | 827 | |
828 | 828 | static int ftmac100_get_settings(struct net_device *netdev, struct ethtool_cmd *cmd) |
drivers/net/ethernet/freescale/fec.c
... | ... | @@ -1168,9 +1168,10 @@ |
1168 | 1168 | { |
1169 | 1169 | struct fec_enet_private *fep = netdev_priv(ndev); |
1170 | 1170 | |
1171 | - strcpy(info->driver, fep->pdev->dev.driver->name); | |
1172 | - strcpy(info->version, "Revision: 1.0"); | |
1173 | - strcpy(info->bus_info, dev_name(&ndev->dev)); | |
1171 | + strlcpy(info->driver, fep->pdev->dev.driver->name, | |
1172 | + sizeof(info->driver)); | |
1173 | + strlcpy(info->version, "Revision: 1.0", sizeof(info->version)); | |
1174 | + strlcpy(info->bus_info, dev_name(&ndev->dev), sizeof(info->bus_info)); | |
1174 | 1175 | } |
1175 | 1176 | |
1176 | 1177 | static const struct ethtool_ops fec_enet_ethtool_ops = { |
drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c
... | ... | @@ -888,8 +888,8 @@ |
888 | 888 | static void fs_get_drvinfo(struct net_device *dev, |
889 | 889 | struct ethtool_drvinfo *info) |
890 | 890 | { |
891 | - strcpy(info->driver, DRV_MODULE_NAME); | |
892 | - strcpy(info->version, DRV_MODULE_VERSION); | |
891 | + strlcpy(info->driver, DRV_MODULE_NAME, sizeof(info->driver)); | |
892 | + strlcpy(info->version, DRV_MODULE_VERSION, sizeof(info->version)); | |
893 | 893 | } |
894 | 894 | |
895 | 895 | static int fs_get_regs_len(struct net_device *dev) |
drivers/net/ethernet/freescale/gianfar.h
... | ... | @@ -649,8 +649,6 @@ |
649 | 649 | /* Number of stats in the stats structure (ignore car and cam regs)*/ |
650 | 650 | #define GFAR_STATS_LEN (GFAR_RMON_LEN + GFAR_EXTRA_STATS_LEN) |
651 | 651 | |
652 | -#define GFAR_INFOSTR_LEN 32 | |
653 | - | |
654 | 652 | struct gfar_stats { |
655 | 653 | u64 extra[GFAR_EXTRA_STATS_LEN]; |
656 | 654 | u64 rmon[GFAR_RMON_LEN]; |
drivers/net/ethernet/freescale/gianfar_ethtool.c
... | ... | @@ -184,10 +184,11 @@ |
184 | 184 | static void gfar_gdrvinfo(struct net_device *dev, |
185 | 185 | struct ethtool_drvinfo *drvinfo) |
186 | 186 | { |
187 | - strncpy(drvinfo->driver, DRV_NAME, GFAR_INFOSTR_LEN); | |
188 | - strncpy(drvinfo->version, gfar_driver_version, GFAR_INFOSTR_LEN); | |
189 | - strncpy(drvinfo->fw_version, "N/A", GFAR_INFOSTR_LEN); | |
190 | - strncpy(drvinfo->bus_info, "N/A", GFAR_INFOSTR_LEN); | |
187 | + strlcpy(drvinfo->driver, DRV_NAME, sizeof(drvinfo->driver)); | |
188 | + strlcpy(drvinfo->version, gfar_driver_version, | |
189 | + sizeof(drvinfo->version)); | |
190 | + strlcpy(drvinfo->fw_version, "N/A", sizeof(drvinfo->fw_version)); | |
191 | + strlcpy(drvinfo->bus_info, "N/A", sizeof(drvinfo->bus_info)); | |
191 | 192 | drvinfo->regdump_len = 0; |
192 | 193 | drvinfo->eedump_len = 0; |
193 | 194 | } |
drivers/net/ethernet/freescale/ucc_geth_ethtool.c
... | ... | @@ -350,10 +350,10 @@ |
350 | 350 | uec_get_drvinfo(struct net_device *netdev, |
351 | 351 | struct ethtool_drvinfo *drvinfo) |
352 | 352 | { |
353 | - strncpy(drvinfo->driver, DRV_NAME, 32); | |
354 | - strncpy(drvinfo->version, DRV_VERSION, 32); | |
355 | - strncpy(drvinfo->fw_version, "N/A", 32); | |
356 | - strncpy(drvinfo->bus_info, "QUICC ENGINE", 32); | |
353 | + strlcpy(drvinfo->driver, DRV_NAME, sizeof(drvinfo->driver)); | |
354 | + strlcpy(drvinfo->version, DRV_VERSION, sizeof(drvinfo->version)); | |
355 | + strlcpy(drvinfo->fw_version, "N/A", sizeof(drvinfo->fw_version)); | |
356 | + strlcpy(drvinfo->bus_info, "QUICC ENGINE", sizeof(drvinfo->bus_info)); | |
357 | 357 | drvinfo->eedump_len = 0; |
358 | 358 | drvinfo->regdump_len = uec_get_regs_len(netdev); |
359 | 359 | } |
drivers/net/ethernet/i825xx/3c505.c
... | ... | @@ -1138,9 +1138,10 @@ |
1138 | 1138 | static void netdev_get_drvinfo(struct net_device *dev, |
1139 | 1139 | struct ethtool_drvinfo *info) |
1140 | 1140 | { |
1141 | - strcpy(info->driver, DRV_NAME); | |
1142 | - strcpy(info->version, DRV_VERSION); | |
1143 | - sprintf(info->bus_info, "ISA 0x%lx", dev->base_addr); | |
1141 | + strlcpy(info->driver, DRV_NAME, sizeof(info->driver)); | |
1142 | + strlcpy(info->version, DRV_VERSION, sizeof(info->version)); | |
1143 | + snprintf(info->bus_info, sizeof(info->bus_info), "ISA 0x%lx", | |
1144 | + dev->base_addr); | |
1144 | 1145 | } |
1145 | 1146 | |
1146 | 1147 | static u32 netdev_get_msglevel(struct net_device *dev) |
drivers/net/ethernet/i825xx/3c507.c
... | ... | @@ -888,9 +888,10 @@ |
888 | 888 | static void netdev_get_drvinfo(struct net_device *dev, |
889 | 889 | struct ethtool_drvinfo *info) |
890 | 890 | { |
891 | - strcpy(info->driver, DRV_NAME); | |
892 | - strcpy(info->version, DRV_VERSION); | |
893 | - sprintf(info->bus_info, "ISA 0x%lx", dev->base_addr); | |
891 | + strlcpy(info->driver, DRV_NAME, sizeof(info->driver)); | |
892 | + strlcpy(info->version, DRV_VERSION, sizeof(info->version)); | |
893 | + snprintf(info->bus_info, sizeof(info->bus_info), "ISA 0x%lx", | |
894 | + dev->base_addr); | |
894 | 895 | } |
895 | 896 | |
896 | 897 | static u32 netdev_get_msglevel(struct net_device *dev) |
drivers/net/ethernet/ibm/emac/core.c
... | ... | @@ -2190,11 +2190,10 @@ |
2190 | 2190 | { |
2191 | 2191 | struct emac_instance *dev = netdev_priv(ndev); |
2192 | 2192 | |
2193 | - strcpy(info->driver, "ibm_emac"); | |
2194 | - strcpy(info->version, DRV_VERSION); | |
2195 | - info->fw_version[0] = '\0'; | |
2196 | - sprintf(info->bus_info, "PPC 4xx EMAC-%d %s", | |
2197 | - dev->cell_index, dev->ofdev->dev.of_node->full_name); | |
2193 | + strlcpy(info->driver, "ibm_emac", sizeof(info->driver)); | |
2194 | + strlcpy(info->version, DRV_VERSION, sizeof(info->version)); | |
2195 | + snprintf(info->bus_info, sizeof(info->bus_info), "PPC 4xx EMAC-%d %s", | |
2196 | + dev->cell_index, dev->ofdev->dev.of_node->full_name); | |
2198 | 2197 | info->regdump_len = emac_ethtool_get_regs_len(ndev); |
2199 | 2198 | } |
2200 | 2199 |
drivers/net/ethernet/ibm/ibmveth.c
... | ... | @@ -722,9 +722,8 @@ |
722 | 722 | static void netdev_get_drvinfo(struct net_device *dev, |
723 | 723 | struct ethtool_drvinfo *info) |
724 | 724 | { |
725 | - strncpy(info->driver, ibmveth_driver_name, sizeof(info->driver) - 1); | |
726 | - strncpy(info->version, ibmveth_driver_version, | |
727 | - sizeof(info->version) - 1); | |
725 | + strlcpy(info->driver, ibmveth_driver_name, sizeof(info->driver)); | |
726 | + strlcpy(info->version, ibmveth_driver_version, sizeof(info->version)); | |
728 | 727 | } |
729 | 728 | |
730 | 729 | static netdev_features_t ibmveth_fix_features(struct net_device *dev, |
drivers/net/ethernet/korina.c
... | ... | @@ -695,9 +695,9 @@ |
695 | 695 | { |
696 | 696 | struct korina_private *lp = netdev_priv(dev); |
697 | 697 | |
698 | - strcpy(info->driver, DRV_NAME); | |
699 | - strcpy(info->version, DRV_VERSION); | |
700 | - strcpy(info->bus_info, lp->dev->name); | |
698 | + strlcpy(info->driver, DRV_NAME, sizeof(info->driver)); | |
699 | + strlcpy(info->version, DRV_VERSION, sizeof(info->version)); | |
700 | + strlcpy(info->bus_info, lp->dev->name, sizeof(info->bus_info)); | |
701 | 701 | } |
702 | 702 | |
703 | 703 | static int netdev_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) |
drivers/net/ethernet/lantiq_etop.c
... | ... | @@ -302,9 +302,9 @@ |
302 | 302 | static void |
303 | 303 | ltq_etop_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info) |
304 | 304 | { |
305 | - strcpy(info->driver, "Lantiq ETOP"); | |
306 | - strcpy(info->bus_info, "internal"); | |
307 | - strcpy(info->version, DRV_VERSION); | |
305 | + strlcpy(info->driver, "Lantiq ETOP", sizeof(info->driver)); | |
306 | + strlcpy(info->bus_info, "internal", sizeof(info->bus_info)); | |
307 | + strlcpy(info->version, DRV_VERSION, sizeof(info->version)); | |
308 | 308 | } |
309 | 309 | |
310 | 310 | static int |
drivers/net/ethernet/marvell/pxa168_eth.c
... | ... | @@ -1443,10 +1443,10 @@ |
1443 | 1443 | static void pxa168_get_drvinfo(struct net_device *dev, |
1444 | 1444 | struct ethtool_drvinfo *info) |
1445 | 1445 | { |
1446 | - strncpy(info->driver, DRIVER_NAME, 32); | |
1447 | - strncpy(info->version, DRIVER_VERSION, 32); | |
1448 | - strncpy(info->fw_version, "N/A", 32); | |
1449 | - strncpy(info->bus_info, "N/A", 32); | |
1446 | + strlcpy(info->driver, DRIVER_NAME, sizeof(info->driver)); | |
1447 | + strlcpy(info->version, DRIVER_VERSION, sizeof(info->version)); | |
1448 | + strlcpy(info->fw_version, "N/A", sizeof(info->fw_version)); | |
1449 | + strlcpy(info->bus_info, "N/A", sizeof(info->bus_info)); | |
1450 | 1450 | } |
1451 | 1451 | |
1452 | 1452 | static const struct ethtool_ops pxa168_ethtool_ops = { |
drivers/net/ethernet/neterion/vxge/vxge-ethtool.c
... | ... | @@ -82,9 +82,9 @@ |
82 | 82 | struct ethtool_drvinfo *info) |
83 | 83 | { |
84 | 84 | struct vxgedev *vdev = netdev_priv(dev); |
85 | - strlcpy(info->driver, VXGE_DRIVER_NAME, sizeof(VXGE_DRIVER_NAME)); | |
86 | - strlcpy(info->version, DRV_VERSION, sizeof(DRV_VERSION)); | |
87 | - strlcpy(info->fw_version, vdev->fw_version, VXGE_HW_FW_STRLEN); | |
85 | + strlcpy(info->driver, VXGE_DRIVER_NAME, sizeof(info->driver)); | |
86 | + strlcpy(info->version, DRV_VERSION, sizeof(info->version)); | |
87 | + strlcpy(info->fw_version, vdev->fw_version, sizeof(info->fw_version)); | |
88 | 88 | strlcpy(info->bus_info, pci_name(vdev->pdev), sizeof(info->bus_info)); |
89 | 89 | info->regdump_len = sizeof(struct vxge_hw_vpath_reg) |
90 | 90 | * vdev->no_of_vpath; |
drivers/net/ethernet/nuvoton/w90p910_ether.c
... | ... | @@ -878,8 +878,8 @@ |
878 | 878 | static void w90p910_get_drvinfo(struct net_device *dev, |
879 | 879 | struct ethtool_drvinfo *info) |
880 | 880 | { |
881 | - strcpy(info->driver, DRV_MODULE_NAME); | |
882 | - strcpy(info->version, DRV_MODULE_VERSION); | |
881 | + strlcpy(info->driver, DRV_MODULE_NAME, sizeof(info->driver)); | |
882 | + strlcpy(info->version, DRV_MODULE_VERSION, sizeof(info->version)); | |
883 | 883 | } |
884 | 884 | |
885 | 885 | static int w90p910_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) |
drivers/net/ethernet/nxp/lpc_eth.c
... | ... | @@ -1239,9 +1239,10 @@ |
1239 | 1239 | static void lpc_eth_ethtool_getdrvinfo(struct net_device *ndev, |
1240 | 1240 | struct ethtool_drvinfo *info) |
1241 | 1241 | { |
1242 | - strcpy(info->driver, MODNAME); | |
1243 | - strcpy(info->version, DRV_VERSION); | |
1244 | - strcpy(info->bus_info, dev_name(ndev->dev.parent)); | |
1242 | + strlcpy(info->driver, MODNAME, sizeof(info->driver)); | |
1243 | + strlcpy(info->version, DRV_VERSION, sizeof(info->version)); | |
1244 | + strlcpy(info->bus_info, dev_name(ndev->dev.parent), | |
1245 | + sizeof(info->bus_info)); | |
1245 | 1246 | } |
1246 | 1247 | |
1247 | 1248 | static u32 lpc_eth_ethtool_getmsglevel(struct net_device *ndev) |
drivers/net/ethernet/octeon/octeon_mgmt.c
... | ... | @@ -1350,10 +1350,10 @@ |
1350 | 1350 | static void octeon_mgmt_get_drvinfo(struct net_device *netdev, |
1351 | 1351 | struct ethtool_drvinfo *info) |
1352 | 1352 | { |
1353 | - strncpy(info->driver, DRV_NAME, sizeof(info->driver)); | |
1354 | - strncpy(info->version, DRV_VERSION, sizeof(info->version)); | |
1355 | - strncpy(info->fw_version, "N/A", sizeof(info->fw_version)); | |
1356 | - strncpy(info->bus_info, "N/A", sizeof(info->bus_info)); | |
1353 | + strlcpy(info->driver, DRV_NAME, sizeof(info->driver)); | |
1354 | + strlcpy(info->version, DRV_VERSION, sizeof(info->version)); | |
1355 | + strlcpy(info->fw_version, "N/A", sizeof(info->fw_version)); | |
1356 | + strlcpy(info->bus_info, "N/A", sizeof(info->bus_info)); | |
1357 | 1357 | info->n_stats = 0; |
1358 | 1358 | info->testinfo_len = 0; |
1359 | 1359 | info->regdump_len = 0; |
drivers/net/ethernet/packetengines/hamachi.c
... | ... | @@ -1808,9 +1808,10 @@ |
1808 | 1808 | static void hamachi_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info) |
1809 | 1809 | { |
1810 | 1810 | struct hamachi_private *np = netdev_priv(dev); |
1811 | - strcpy(info->driver, DRV_NAME); | |
1812 | - strcpy(info->version, DRV_VERSION); | |
1813 | - strcpy(info->bus_info, pci_name(np->pci_dev)); | |
1811 | + | |
1812 | + strlcpy(info->driver, DRV_NAME, sizeof(info->driver)); | |
1813 | + strlcpy(info->version, DRV_VERSION, sizeof(info->version)); | |
1814 | + strlcpy(info->bus_info, pci_name(np->pci_dev), sizeof(info->bus_info)); | |
1814 | 1815 | } |
1815 | 1816 | |
1816 | 1817 | static int hamachi_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd) |
drivers/net/ethernet/packetengines/yellowfin.c
... | ... | @@ -1326,9 +1326,10 @@ |
1326 | 1326 | static void yellowfin_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info) |
1327 | 1327 | { |
1328 | 1328 | struct yellowfin_private *np = netdev_priv(dev); |
1329 | - strcpy(info->driver, DRV_NAME); | |
1330 | - strcpy(info->version, DRV_VERSION); | |
1331 | - strcpy(info->bus_info, pci_name(np->pci_dev)); | |
1329 | + | |
1330 | + strlcpy(info->driver, DRV_NAME, sizeof(info->driver)); | |
1331 | + strlcpy(info->version, DRV_VERSION, sizeof(info->version)); | |
1332 | + strlcpy(info->bus_info, pci_name(np->pci_dev), sizeof(info->bus_info)); | |
1332 | 1333 | } |
1333 | 1334 | |
1334 | 1335 | static const struct ethtool_ops ethtool_ops = { |
drivers/net/ethernet/rdc/r6040.c
... | ... | @@ -957,9 +957,9 @@ |
957 | 957 | { |
958 | 958 | struct r6040_private *rp = netdev_priv(dev); |
959 | 959 | |
960 | - strcpy(info->driver, DRV_NAME); | |
961 | - strcpy(info->version, DRV_VERSION); | |
962 | - strcpy(info->bus_info, pci_name(rp->pdev)); | |
960 | + strlcpy(info->driver, DRV_NAME, sizeof(info->driver)); | |
961 | + strlcpy(info->version, DRV_VERSION, sizeof(info->version)); | |
962 | + strlcpy(info->bus_info, pci_name(rp->pdev), sizeof(info->bus_info)); | |
963 | 963 | } |
964 | 964 | |
965 | 965 | static int netdev_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) |
drivers/net/ethernet/sgi/ioc3-eth.c
... | ... | @@ -1565,9 +1565,9 @@ |
1565 | 1565 | { |
1566 | 1566 | struct ioc3_private *ip = netdev_priv(dev); |
1567 | 1567 | |
1568 | - strcpy (info->driver, IOC3_NAME); | |
1569 | - strcpy (info->version, IOC3_VERSION); | |
1570 | - strcpy (info->bus_info, pci_name(ip->pdev)); | |
1568 | + strlcpy(info->driver, IOC3_NAME, sizeof(info->driver)); | |
1569 | + strlcpy(info->version, IOC3_VERSION, sizeof(info->version)); | |
1570 | + strlcpy(info->bus_info, pci_name(ip->pdev), sizeof(info->bus_info)); | |
1571 | 1571 | } |
1572 | 1572 | |
1573 | 1573 | static int ioc3_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) |
drivers/net/ethernet/smsc/smc911x.c
... | ... | @@ -1522,9 +1522,10 @@ |
1522 | 1522 | static void |
1523 | 1523 | smc911x_ethtool_getdrvinfo(struct net_device *dev, struct ethtool_drvinfo *info) |
1524 | 1524 | { |
1525 | - strncpy(info->driver, CARDNAME, sizeof(info->driver)); | |
1526 | - strncpy(info->version, version, sizeof(info->version)); | |
1527 | - strncpy(info->bus_info, dev_name(dev->dev.parent), sizeof(info->bus_info)); | |
1525 | + strlcpy(info->driver, CARDNAME, sizeof(info->driver)); | |
1526 | + strlcpy(info->version, version, sizeof(info->version)); | |
1527 | + strlcpy(info->bus_info, dev_name(dev->dev.parent), | |
1528 | + sizeof(info->bus_info)); | |
1528 | 1529 | } |
1529 | 1530 | |
1530 | 1531 | static int smc911x_ethtool_nwayreset(struct net_device *dev) |
drivers/net/ethernet/smsc/smc91x.c
... | ... | @@ -1597,9 +1597,10 @@ |
1597 | 1597 | static void |
1598 | 1598 | smc_ethtool_getdrvinfo(struct net_device *dev, struct ethtool_drvinfo *info) |
1599 | 1599 | { |
1600 | - strncpy(info->driver, CARDNAME, sizeof(info->driver)); | |
1601 | - strncpy(info->version, version, sizeof(info->version)); | |
1602 | - strncpy(info->bus_info, dev_name(dev->dev.parent), sizeof(info->bus_info)); | |
1600 | + strlcpy(info->driver, CARDNAME, sizeof(info->driver)); | |
1601 | + strlcpy(info->version, version, sizeof(info->version)); | |
1602 | + strlcpy(info->bus_info, dev_name(dev->dev.parent), | |
1603 | + sizeof(info->bus_info)); | |
1603 | 1604 | } |
1604 | 1605 | |
1605 | 1606 | static int smc_ethtool_nwayreset(struct net_device *dev) |
drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c
... | ... | @@ -210,8 +210,7 @@ |
210 | 210 | strlcpy(info->driver, MAC100_ETHTOOL_NAME, |
211 | 211 | sizeof(info->driver)); |
212 | 212 | |
213 | - strcpy(info->version, DRV_MODULE_VERSION); | |
214 | - info->fw_version[0] = '\0'; | |
213 | + strlcpy(info->version, DRV_MODULE_VERSION, sizeof(info->version)); | |
215 | 214 | } |
216 | 215 | |
217 | 216 | static int stmmac_ethtool_getsettings(struct net_device *dev, |
drivers/net/ethernet/sun/sunbmac.c
... | ... | @@ -1042,8 +1042,8 @@ |
1042 | 1042 | /* Ethtool support... */ |
1043 | 1043 | static void bigmac_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info) |
1044 | 1044 | { |
1045 | - strcpy(info->driver, "sunbmac"); | |
1046 | - strcpy(info->version, "2.0"); | |
1045 | + strlcpy(info->driver, "sunbmac", sizeof(info->driver)); | |
1046 | + strlcpy(info->version, "2.0", sizeof(info->version)); | |
1047 | 1047 | } |
1048 | 1048 | |
1049 | 1049 | static u32 bigmac_get_link(struct net_device *dev) |
drivers/net/ethernet/sun/sunqe.c
... | ... | @@ -685,13 +685,14 @@ |
685 | 685 | struct sunqe *qep = netdev_priv(dev); |
686 | 686 | struct platform_device *op; |
687 | 687 | |
688 | - strcpy(info->driver, "sunqe"); | |
689 | - strcpy(info->version, "3.0"); | |
688 | + strlcpy(info->driver, "sunqe", sizeof(info->driver)); | |
689 | + strlcpy(info->version, "3.0", sizeof(info->version)); | |
690 | 690 | |
691 | 691 | op = qep->op; |
692 | 692 | regs = of_get_property(op->dev.of_node, "reg", NULL); |
693 | 693 | if (regs) |
694 | - sprintf(info->bus_info, "SBUS:%d", regs->which_io); | |
694 | + snprintf(info->bus_info, sizeof(info->bus_info), "SBUS:%d", | |
695 | + regs->which_io); | |
695 | 696 | |
696 | 697 | } |
697 | 698 |
drivers/net/ethernet/sun/sunvnet.c
... | ... | @@ -882,8 +882,8 @@ |
882 | 882 | static void vnet_get_drvinfo(struct net_device *dev, |
883 | 883 | struct ethtool_drvinfo *info) |
884 | 884 | { |
885 | - strcpy(info->driver, DRV_MODULE_NAME); | |
886 | - strcpy(info->version, DRV_MODULE_VERSION); | |
885 | + strlcpy(info->driver, DRV_MODULE_NAME, sizeof(info->driver)); | |
886 | + strlcpy(info->version, DRV_MODULE_VERSION, sizeof(info->version)); | |
887 | 887 | } |
888 | 888 | |
889 | 889 | static u32 vnet_get_msglevel(struct net_device *dev) |
drivers/net/ethernet/tehuti/tehuti.c
... | ... | @@ -2179,10 +2179,10 @@ |
2179 | 2179 | { |
2180 | 2180 | struct bdx_priv *priv = netdev_priv(netdev); |
2181 | 2181 | |
2182 | - strlcat(drvinfo->driver, BDX_DRV_NAME, sizeof(drvinfo->driver)); | |
2183 | - strlcat(drvinfo->version, BDX_DRV_VERSION, sizeof(drvinfo->version)); | |
2184 | - strlcat(drvinfo->fw_version, "N/A", sizeof(drvinfo->fw_version)); | |
2185 | - strlcat(drvinfo->bus_info, pci_name(priv->pdev), | |
2182 | + strlcpy(drvinfo->driver, BDX_DRV_NAME, sizeof(drvinfo->driver)); | |
2183 | + strlcpy(drvinfo->version, BDX_DRV_VERSION, sizeof(drvinfo->version)); | |
2184 | + strlcpy(drvinfo->fw_version, "N/A", sizeof(drvinfo->fw_version)); | |
2185 | + strlcpy(drvinfo->bus_info, pci_name(priv->pdev), | |
2186 | 2186 | sizeof(drvinfo->bus_info)); |
2187 | 2187 | |
2188 | 2188 | drvinfo->n_stats = ((priv->stats_flag) ? ARRAY_SIZE(bdx_stat_names) : 0); |
drivers/net/ethernet/ti/cpmac.c
... | ... | @@ -904,10 +904,9 @@ |
904 | 904 | static void cpmac_get_drvinfo(struct net_device *dev, |
905 | 905 | struct ethtool_drvinfo *info) |
906 | 906 | { |
907 | - strcpy(info->driver, "cpmac"); | |
908 | - strcpy(info->version, CPMAC_VERSION); | |
909 | - info->fw_version[0] = '\0'; | |
910 | - sprintf(info->bus_info, "%s", "cpmac"); | |
907 | + strlcpy(info->driver, "cpmac", sizeof(info->driver)); | |
908 | + strlcpy(info->version, CPMAC_VERSION, sizeof(info->version)); | |
909 | + snprintf(info->bus_info, sizeof(info->bus_info), "%s", "cpmac"); | |
911 | 910 | info->regdump_len = 0; |
912 | 911 | } |
913 | 912 |
drivers/net/ethernet/ti/cpsw.c
... | ... | @@ -944,9 +944,10 @@ |
944 | 944 | struct ethtool_drvinfo *info) |
945 | 945 | { |
946 | 946 | struct cpsw_priv *priv = netdev_priv(ndev); |
947 | - strcpy(info->driver, "TI CPSW Driver v1.0"); | |
948 | - strcpy(info->version, "1.0"); | |
949 | - strcpy(info->bus_info, priv->pdev->name); | |
947 | + | |
948 | + strlcpy(info->driver, "TI CPSW Driver v1.0", sizeof(info->driver)); | |
949 | + strlcpy(info->version, "1.0", sizeof(info->version)); | |
950 | + strlcpy(info->bus_info, priv->pdev->name, sizeof(info->bus_info)); | |
950 | 951 | } |
951 | 952 | |
952 | 953 | static u32 cpsw_get_msglevel(struct net_device *ndev) |
drivers/net/ethernet/ti/davinci_emac.c
... | ... | @@ -480,8 +480,8 @@ |
480 | 480 | static void emac_get_drvinfo(struct net_device *ndev, |
481 | 481 | struct ethtool_drvinfo *info) |
482 | 482 | { |
483 | - strcpy(info->driver, emac_version_string); | |
484 | - strcpy(info->version, EMAC_MODULE_VERSION); | |
483 | + strlcpy(info->driver, emac_version_string, sizeof(info->driver)); | |
484 | + strlcpy(info->version, EMAC_MODULE_VERSION, sizeof(info->version)); | |
485 | 485 | } |
486 | 486 | |
487 | 487 | /** |
drivers/net/ethernet/toshiba/ps3_gelic_net.c
... | ... | @@ -1226,8 +1226,8 @@ |
1226 | 1226 | void gelic_net_get_drvinfo(struct net_device *netdev, |
1227 | 1227 | struct ethtool_drvinfo *info) |
1228 | 1228 | { |
1229 | - strncpy(info->driver, DRV_NAME, sizeof(info->driver) - 1); | |
1230 | - strncpy(info->version, DRV_VERSION, sizeof(info->version) - 1); | |
1229 | + strlcpy(info->driver, DRV_NAME, sizeof(info->driver)); | |
1230 | + strlcpy(info->version, DRV_VERSION, sizeof(info->version)); | |
1231 | 1231 | } |
1232 | 1232 | |
1233 | 1233 | static int gelic_ether_get_settings(struct net_device *netdev, |
drivers/net/ethernet/toshiba/spider_net_ethtool.c
... | ... | @@ -72,11 +72,13 @@ |
72 | 72 | card = netdev_priv(netdev); |
73 | 73 | |
74 | 74 | /* clear and fill out info */ |
75 | - memset(drvinfo, 0, sizeof(struct ethtool_drvinfo)); | |
76 | - strncpy(drvinfo->driver, spider_net_driver_name, 32); | |
77 | - strncpy(drvinfo->version, VERSION, 32); | |
78 | - strcpy(drvinfo->fw_version, "no information"); | |
79 | - strncpy(drvinfo->bus_info, pci_name(card->pdev), 32); | |
75 | + strlcpy(drvinfo->driver, spider_net_driver_name, | |
76 | + sizeof(drvinfo->driver)); | |
77 | + strlcpy(drvinfo->version, VERSION, sizeof(drvinfo->version)); | |
78 | + strlcpy(drvinfo->fw_version, "no information", | |
79 | + sizeof(drvinfo->fw_version)); | |
80 | + strlcpy(drvinfo->bus_info, pci_name(card->pdev), | |
81 | + sizeof(drvinfo->bus_info)); | |
80 | 82 | } |
81 | 83 | |
82 | 84 | static void |
drivers/net/ethernet/toshiba/tc35815.c
... | ... | @@ -1976,9 +1976,10 @@ |
1976 | 1976 | static void tc35815_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info) |
1977 | 1977 | { |
1978 | 1978 | struct tc35815_local *lp = netdev_priv(dev); |
1979 | - strcpy(info->driver, MODNAME); | |
1980 | - strcpy(info->version, DRV_VERSION); | |
1981 | - strcpy(info->bus_info, pci_name(lp->pci_dev)); | |
1979 | + | |
1980 | + strlcpy(info->driver, MODNAME, sizeof(info->driver)); | |
1981 | + strlcpy(info->version, DRV_VERSION, sizeof(info->version)); | |
1982 | + strlcpy(info->bus_info, pci_name(lp->pci_dev), sizeof(info->bus_info)); | |
1982 | 1983 | } |
1983 | 1984 | |
1984 | 1985 | static int tc35815_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) |
drivers/net/ethernet/xilinx/xilinx_axienet_main.c
... | ... | @@ -1124,9 +1124,8 @@ |
1124 | 1124 | static void axienet_ethtools_get_drvinfo(struct net_device *ndev, |
1125 | 1125 | struct ethtool_drvinfo *ed) |
1126 | 1126 | { |
1127 | - memset(ed, 0, sizeof(struct ethtool_drvinfo)); | |
1128 | - strcpy(ed->driver, DRIVER_NAME); | |
1129 | - strcpy(ed->version, DRIVER_VERSION); | |
1127 | + strlcpy(ed->driver, DRIVER_NAME, sizeof(ed->driver)); | |
1128 | + strlcpy(ed->version, DRIVER_VERSION, sizeof(ed->version)); | |
1130 | 1129 | ed->regdump_len = sizeof(u32) * AXIENET_REGS_N; |
1131 | 1130 | } |
1132 | 1131 |
drivers/net/ethernet/xircom/xirc2ps_cs.c
... | ... | @@ -1412,7 +1412,8 @@ |
1412 | 1412 | struct ethtool_drvinfo *info) |
1413 | 1413 | { |
1414 | 1414 | strlcpy(info->driver, "xirc2ps_cs", sizeof(info->driver)); |
1415 | - sprintf(info->bus_info, "PCMCIA 0x%lx", dev->base_addr); | |
1415 | + snprintf(info->bus_info, sizeof(info->bus_info), "PCMCIA 0x%lx", | |
1416 | + dev->base_addr); | |
1416 | 1417 | } |
1417 | 1418 | |
1418 | 1419 | static const struct ethtool_ops netdev_ethtool_ops = { |
drivers/net/ethernet/xscale/ixp4xx_eth.c
... | ... | @@ -977,11 +977,12 @@ |
977 | 977 | struct ethtool_drvinfo *info) |
978 | 978 | { |
979 | 979 | struct port *port = netdev_priv(dev); |
980 | - strcpy(info->driver, DRV_NAME); | |
980 | + | |
981 | + strlcpy(info->driver, DRV_NAME, sizeof(info->driver)); | |
981 | 982 | snprintf(info->fw_version, sizeof(info->fw_version), "%u:%u:%u:%u", |
982 | 983 | port->firmware[0], port->firmware[1], |
983 | 984 | port->firmware[2], port->firmware[3]); |
984 | - strcpy(info->bus_info, "internal"); | |
985 | + strlcpy(info->bus_info, "internal", sizeof(info->bus_info)); | |
985 | 986 | } |
986 | 987 | |
987 | 988 | static int ixp4xx_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) |
drivers/net/hyperv/netvsc_drv.c
... | ... | @@ -304,9 +304,9 @@ |
304 | 304 | static void netvsc_get_drvinfo(struct net_device *net, |
305 | 305 | struct ethtool_drvinfo *info) |
306 | 306 | { |
307 | - strcpy(info->driver, KBUILD_MODNAME); | |
308 | - strcpy(info->version, HV_DRV_VERSION); | |
309 | - strcpy(info->fw_version, "N/A"); | |
307 | + strlcpy(info->driver, KBUILD_MODNAME, sizeof(info->driver)); | |
308 | + strlcpy(info->version, HV_DRV_VERSION, sizeof(info->version)); | |
309 | + strlcpy(info->fw_version, "N/A", sizeof(info->fw_version)); | |
310 | 310 | } |
311 | 311 | |
312 | 312 | static int netvsc_change_mtu(struct net_device *ndev, int mtu) |
drivers/net/macvlan.c
... | ... | @@ -585,8 +585,8 @@ |
585 | 585 | static void macvlan_ethtool_get_drvinfo(struct net_device *dev, |
586 | 586 | struct ethtool_drvinfo *drvinfo) |
587 | 587 | { |
588 | - snprintf(drvinfo->driver, 32, "macvlan"); | |
589 | - snprintf(drvinfo->version, 32, "0.1"); | |
588 | + strlcpy(drvinfo->driver, "macvlan", sizeof(drvinfo->driver)); | |
589 | + strlcpy(drvinfo->version, "0.1", sizeof(drvinfo->version)); | |
590 | 590 | } |
591 | 591 | |
592 | 592 | static int macvlan_ethtool_get_settings(struct net_device *dev, |
drivers/net/rionet.c
... | ... | @@ -410,10 +410,10 @@ |
410 | 410 | { |
411 | 411 | struct rionet_private *rnet = netdev_priv(ndev); |
412 | 412 | |
413 | - strcpy(info->driver, DRV_NAME); | |
414 | - strcpy(info->version, DRV_VERSION); | |
415 | - strcpy(info->fw_version, "n/a"); | |
416 | - strcpy(info->bus_info, rnet->mport->name); | |
413 | + strlcpy(info->driver, DRV_NAME, sizeof(info->driver)); | |
414 | + strlcpy(info->version, DRV_VERSION, sizeof(info->version)); | |
415 | + strlcpy(info->fw_version, "n/a", sizeof(info->fw_version)); | |
416 | + strlcpy(info->bus_info, rnet->mport->name, sizeof(info->bus_info)); | |
417 | 417 | } |
418 | 418 | |
419 | 419 | static u32 rionet_get_msglevel(struct net_device *ndev) |
drivers/net/usb/asix_common.c
... | ... | @@ -510,8 +510,8 @@ |
510 | 510 | { |
511 | 511 | /* Inherit standard device info */ |
512 | 512 | usbnet_get_drvinfo(net, info); |
513 | - strncpy (info->driver, DRIVER_NAME, sizeof info->driver); | |
514 | - strncpy (info->version, DRIVER_VERSION, sizeof info->version); | |
513 | + strlcpy(info->driver, DRIVER_NAME, sizeof(info->driver)); | |
514 | + strlcpy(info->version, DRIVER_VERSION, sizeof(info->version)); | |
515 | 515 | info->eedump_len = AX_EEPROM_LEN; |
516 | 516 | } |
517 | 517 |
drivers/net/usb/catc.c
... | ... | @@ -685,9 +685,9 @@ |
685 | 685 | struct ethtool_drvinfo *info) |
686 | 686 | { |
687 | 687 | struct catc *catc = netdev_priv(dev); |
688 | - strncpy(info->driver, driver_name, ETHTOOL_BUSINFO_LEN); | |
689 | - strncpy(info->version, DRIVER_VERSION, ETHTOOL_BUSINFO_LEN); | |
690 | - usb_make_path (catc->usbdev, info->bus_info, sizeof info->bus_info); | |
688 | + strlcpy(info->driver, driver_name, sizeof(info->driver)); | |
689 | + strlcpy(info->version, DRIVER_VERSION, sizeof(info->version)); | |
690 | + usb_make_path(catc->usbdev, info->bus_info, sizeof(info->bus_info)); | |
691 | 691 | } |
692 | 692 | |
693 | 693 | static int catc_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) |
drivers/net/usb/cdc_ncm.c
... | ... | @@ -65,9 +65,9 @@ |
65 | 65 | { |
66 | 66 | struct usbnet *dev = netdev_priv(net); |
67 | 67 | |
68 | - strncpy(info->driver, dev->driver_name, sizeof(info->driver)); | |
69 | - strncpy(info->version, DRIVER_VERSION, sizeof(info->version)); | |
70 | - strncpy(info->fw_version, dev->driver_info->description, | |
68 | + strlcpy(info->driver, dev->driver_name, sizeof(info->driver)); | |
69 | + strlcpy(info->version, DRIVER_VERSION, sizeof(info->version)); | |
70 | + strlcpy(info->fw_version, dev->driver_info->description, | |
71 | 71 | sizeof(info->fw_version)); |
72 | 72 | usb_make_path(dev->udev, info->bus_info, sizeof(info->bus_info)); |
73 | 73 | } |
drivers/net/usb/pegasus.c
... | ... | @@ -1074,8 +1074,9 @@ |
1074 | 1074 | struct ethtool_drvinfo *info) |
1075 | 1075 | { |
1076 | 1076 | pegasus_t *pegasus = netdev_priv(dev); |
1077 | - strncpy(info->driver, driver_name, sizeof(info->driver) - 1); | |
1078 | - strncpy(info->version, DRIVER_VERSION, sizeof(info->version) - 1); | |
1077 | + | |
1078 | + strlcpy(info->driver, driver_name, sizeof(info->driver)); | |
1079 | + strlcpy(info->version, DRIVER_VERSION, sizeof(info->version)); | |
1079 | 1080 | usb_make_path(pegasus->usb, info->bus_info, sizeof(info->bus_info)); |
1080 | 1081 | } |
1081 | 1082 |
drivers/net/usb/rtl8150.c
... | ... | @@ -776,9 +776,9 @@ |
776 | 776 | { |
777 | 777 | rtl8150_t *dev = netdev_priv(netdev); |
778 | 778 | |
779 | - strncpy(info->driver, driver_name, ETHTOOL_BUSINFO_LEN); | |
780 | - strncpy(info->version, DRIVER_VERSION, ETHTOOL_BUSINFO_LEN); | |
781 | - usb_make_path(dev->udev, info->bus_info, sizeof info->bus_info); | |
779 | + strlcpy(info->driver, driver_name, sizeof(info->driver)); | |
780 | + strlcpy(info->version, DRIVER_VERSION, sizeof(info->version)); | |
781 | + usb_make_path(dev->udev, info->bus_info, sizeof(info->bus_info)); | |
782 | 782 | } |
783 | 783 | |
784 | 784 | static int rtl8150_get_settings(struct net_device *netdev, struct ethtool_cmd *ecmd) |
drivers/net/usb/sierra_net.c
... | ... | @@ -598,8 +598,8 @@ |
598 | 598 | { |
599 | 599 | /* Inherit standard device info */ |
600 | 600 | usbnet_get_drvinfo(net, info); |
601 | - strncpy(info->driver, driver_name, sizeof info->driver); | |
602 | - strncpy(info->version, DRIVER_VERSION, sizeof info->version); | |
601 | + strlcpy(info->driver, driver_name, sizeof(info->driver)); | |
602 | + strlcpy(info->version, DRIVER_VERSION, sizeof(info->version)); | |
603 | 603 | } |
604 | 604 | |
605 | 605 | static u32 sierra_net_get_link(struct net_device *net) |
drivers/net/vmxnet3/vmxnet3_ethtool.c
... | ... | @@ -207,7 +207,7 @@ |
207 | 207 | sizeof(drvinfo->version)); |
208 | 208 | |
209 | 209 | strlcpy(drvinfo->bus_info, pci_name(adapter->pdev), |
210 | - ETHTOOL_BUSINFO_LEN); | |
210 | + sizeof(drvinfo->bus_info)); | |
211 | 211 | drvinfo->n_stats = vmxnet3_get_sset_count(netdev, ETH_SS_STATS); |
212 | 212 | drvinfo->testinfo_len = 0; |
213 | 213 | drvinfo->eedump_len = 0; |
drivers/net/wimax/i2400m/netdev.c
... | ... | @@ -596,12 +596,12 @@ |
596 | 596 | { |
597 | 597 | struct i2400m *i2400m = net_dev_to_i2400m(net_dev); |
598 | 598 | |
599 | - strncpy(info->driver, KBUILD_MODNAME, sizeof(info->driver) - 1); | |
600 | - strncpy(info->fw_version, | |
601 | - i2400m->fw_name ? : "", sizeof(info->fw_version) - 1); | |
599 | + strlcpy(info->driver, KBUILD_MODNAME, sizeof(info->driver)); | |
600 | + strlcpy(info->fw_version, i2400m->fw_name ? : "", | |
601 | + sizeof(info->fw_version)); | |
602 | 602 | if (net_dev->dev.parent) |
603 | - strncpy(info->bus_info, dev_name(net_dev->dev.parent), | |
604 | - sizeof(info->bus_info) - 1); | |
603 | + strlcpy(info->bus_info, dev_name(net_dev->dev.parent), | |
604 | + sizeof(info->bus_info)); | |
605 | 605 | } |
606 | 606 | |
607 | 607 | static const struct ethtool_ops i2400m_ethtool_ops = { |
drivers/net/wimax/i2400m/usb.c
... | ... | @@ -346,9 +346,9 @@ |
346 | 346 | struct i2400mu *i2400mu = container_of(i2400m, struct i2400mu, i2400m); |
347 | 347 | struct usb_device *udev = i2400mu->usb_dev; |
348 | 348 | |
349 | - strncpy(info->driver, KBUILD_MODNAME, sizeof(info->driver) - 1); | |
350 | - strncpy(info->fw_version, | |
351 | - i2400m->fw_name ? : "", sizeof(info->fw_version) - 1); | |
349 | + strlcpy(info->driver, KBUILD_MODNAME, sizeof(info->driver)); | |
350 | + strlcpy(info->fw_version, i2400m->fw_name ? : "", | |
351 | + sizeof(info->fw_version)); | |
352 | 352 | usb_make_path(udev, info->bus_info, sizeof(info->bus_info)); |
353 | 353 | } |
354 | 354 |
drivers/net/wireless/brcm80211/brcmfmac/dhd_linux.c
... | ... | @@ -395,9 +395,11 @@ |
395 | 395 | struct brcmf_if *ifp = netdev_priv(ndev); |
396 | 396 | struct brcmf_pub *drvr = ifp->drvr; |
397 | 397 | |
398 | - sprintf(info->driver, KBUILD_MODNAME); | |
399 | - sprintf(info->version, "%lu", drvr->drv_version); | |
400 | - sprintf(info->bus_info, "%s", dev_name(drvr->bus_if->dev)); | |
398 | + strlcpy(info->driver, KBUILD_MODNAME, sizeof(info->driver)); | |
399 | + snprintf(info->version, sizeof(info->version), "%lu", | |
400 | + drvr->drv_version); | |
401 | + strlcpy(info->bus_info, dev_name(drvr->bus_if->dev), | |
402 | + sizeof(info->bus_info)); | |
401 | 403 | } |
402 | 404 | |
403 | 405 | static const struct ethtool_ops brcmf_ethtool_ops = { |
drivers/s390/net/qeth_core_main.c
... | ... | @@ -5444,17 +5444,14 @@ |
5444 | 5444 | struct ethtool_drvinfo *info) |
5445 | 5445 | { |
5446 | 5446 | struct qeth_card *card = dev->ml_priv; |
5447 | - if (card->options.layer2) | |
5448 | - strcpy(info->driver, "qeth_l2"); | |
5449 | - else | |
5450 | - strcpy(info->driver, "qeth_l3"); | |
5451 | 5447 | |
5452 | - strcpy(info->version, "1.0"); | |
5453 | - strcpy(info->fw_version, card->info.mcl_level); | |
5454 | - sprintf(info->bus_info, "%s/%s/%s", | |
5455 | - CARD_RDEV_ID(card), | |
5456 | - CARD_WDEV_ID(card), | |
5457 | - CARD_DDEV_ID(card)); | |
5448 | + strlcpy(info->driver, card->options.layer2 ? "qeth_l2" : "qeth_l3", | |
5449 | + sizeof(info->driver)); | |
5450 | + strlcpy(info->version, "1.0", sizeof(info->version)); | |
5451 | + strlcpy(info->fw_version, card->info.mcl_level, | |
5452 | + sizeof(info->fw_version)); | |
5453 | + snprintf(info->bus_info, sizeof(info->bus_info), "%s/%s/%s", | |
5454 | + CARD_RDEV_ID(card), CARD_WDEV_ID(card), CARD_DDEV_ID(card)); | |
5458 | 5455 | } |
5459 | 5456 | EXPORT_SYMBOL_GPL(qeth_core_get_drvinfo); |
5460 | 5457 |
drivers/staging/bcm/Bcmnet.c
... | ... | @@ -145,8 +145,8 @@ |
145 | 145 | struct bcm_interface_adapter *psIntfAdapter = Adapter->pvInterfaceAdapter; |
146 | 146 | struct usb_device *udev = interface_to_usbdev(psIntfAdapter->interface); |
147 | 147 | |
148 | - strcpy(info->driver, DRV_NAME); | |
149 | - strcpy(info->version, DRV_VERSION); | |
148 | + strlcpy(info->driver, DRV_NAME, sizeof(info->driver)); | |
149 | + strlcpy(info->version, DRV_VERSION, sizeof(info->version)); | |
150 | 150 | snprintf(info->fw_version, sizeof(info->fw_version), "%u.%u", |
151 | 151 | Adapter->uiFlashLayoutMajorVersion, |
152 | 152 | Adapter->uiFlashLayoutMinorVersion); |
drivers/staging/ccg/u_ether.c
... | ... | @@ -157,12 +157,12 @@ |
157 | 157 | |
158 | 158 | static void eth_get_drvinfo(struct net_device *net, struct ethtool_drvinfo *p) |
159 | 159 | { |
160 | - struct eth_dev *dev = netdev_priv(net); | |
160 | + struct eth_dev *dev = netdev_priv(net); | |
161 | 161 | |
162 | - strlcpy(p->driver, "g_ether", sizeof p->driver); | |
163 | - strlcpy(p->version, UETH__VERSION, sizeof p->version); | |
164 | - strlcpy(p->fw_version, dev->gadget->name, sizeof p->fw_version); | |
165 | - strlcpy(p->bus_info, dev_name(&dev->gadget->dev), sizeof p->bus_info); | |
162 | + strlcpy(p->driver, "g_ether", sizeof(p->driver)); | |
163 | + strlcpy(p->version, UETH__VERSION, sizeof(p->version)); | |
164 | + strlcpy(p->fw_version, dev->gadget->name, sizeof(p->fw_version)); | |
165 | + strlcpy(p->bus_info, dev_name(&dev->gadget->dev), sizeof(p->bus_info)); | |
166 | 166 | } |
167 | 167 | |
168 | 168 | /* REVISIT can also support: |
drivers/staging/et131x/et131x.c
... | ... | @@ -3560,15 +3560,15 @@ |
3560 | 3560 | regs_buff[num++] = readl(&aregs->rxdma.fbr1_min_des); |
3561 | 3561 | } |
3562 | 3562 | |
3563 | -#define ET131X_DRVINFO_LEN 32 /* value from ethtool.h */ | |
3564 | 3563 | static void et131x_get_drvinfo(struct net_device *netdev, |
3565 | 3564 | struct ethtool_drvinfo *info) |
3566 | 3565 | { |
3567 | 3566 | struct et131x_adapter *adapter = netdev_priv(netdev); |
3568 | 3567 | |
3569 | - strncpy(info->driver, DRIVER_NAME, ET131X_DRVINFO_LEN); | |
3570 | - strncpy(info->version, DRIVER_VERSION, ET131X_DRVINFO_LEN); | |
3571 | - strncpy(info->bus_info, pci_name(adapter->pdev), ET131X_DRVINFO_LEN); | |
3568 | + strlcpy(info->driver, DRIVER_NAME, sizeof(info->driver)); | |
3569 | + strlcpy(info->version, DRIVER_VERSION, sizeof(info->version)); | |
3570 | + strlcpy(info->bus_info, pci_name(adapter->pdev), | |
3571 | + sizeof(info->bus_info)); | |
3572 | 3572 | } |
3573 | 3573 | |
3574 | 3574 | static struct ethtool_ops et131x_ethtool_ops = { |
drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c
... | ... | @@ -2077,11 +2077,12 @@ |
2077 | 2077 | struct ft1000_info *ft_info; |
2078 | 2078 | ft_info = netdev_priv(dev); |
2079 | 2079 | |
2080 | - snprintf(info->driver, 32, "ft1000"); | |
2081 | - snprintf(info->bus_info, ETHTOOL_BUSINFO_LEN, "PCMCIA 0x%lx", | |
2080 | + strlcpy(info->driver, "ft1000", sizeof(info->driver)); | |
2081 | + snprintf(info->bus_info, sizeof(info->bus_info), "PCMCIA 0x%lx", | |
2082 | 2082 | dev->base_addr); |
2083 | - snprintf(info->fw_version, 32, "%d.%d.%d.%d", ft_info->DspVer[0], | |
2084 | - ft_info->DspVer[1], ft_info->DspVer[2], ft_info->DspVer[3]); | |
2083 | + snprintf(info->fw_version, sizeof(info->fw_version), "%d.%d.%d.%d", | |
2084 | + ft_info->DspVer[0], ft_info->DspVer[1], ft_info->DspVer[2], | |
2085 | + ft_info->DspVer[3]); | |
2085 | 2086 | } |
2086 | 2087 | |
2087 | 2088 | static u32 ft1000_get_link(struct net_device *dev) |
drivers/staging/octeon/ethernet-mdio.c
... | ... | @@ -46,9 +46,9 @@ |
46 | 46 | static void cvm_oct_get_drvinfo(struct net_device *dev, |
47 | 47 | struct ethtool_drvinfo *info) |
48 | 48 | { |
49 | - strcpy(info->driver, "cavium-ethernet"); | |
50 | - strcpy(info->version, OCTEON_ETHERNET_VERSION); | |
51 | - strcpy(info->bus_info, "Builtin"); | |
49 | + strlcpy(info->driver, "cavium-ethernet", sizeof(info->driver)); | |
50 | + strlcpy(info->version, OCTEON_ETHERNET_VERSION, sizeof(info->version)); | |
51 | + strlcpy(info->bus_info, "Builtin", sizeof(info->bus_info)); | |
52 | 52 | } |
53 | 53 | |
54 | 54 | static int cvm_oct_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) |
drivers/staging/rtl8192e/rtl8192e/rtl_ethtool.c
... | ... | @@ -34,9 +34,9 @@ |
34 | 34 | { |
35 | 35 | struct r8192_priv *priv = rtllib_priv(dev); |
36 | 36 | |
37 | - strcpy(info->driver, DRV_NAME); | |
38 | - strcpy(info->version, DRV_VERSION); | |
39 | - strcpy(info->bus_info, pci_name(priv->pdev)); | |
37 | + strlcpy(info->driver, DRV_NAME, sizeof(info->driver)); | |
38 | + strlcpy(info->version, DRV_VERSION, sizeof(info->version)); | |
39 | + strlcpy(info->bus_info, pci_name(priv->pdev), sizeof(info->bus_info)); | |
40 | 40 | } |
41 | 41 | |
42 | 42 | static u32 rtl819x_ethtool_get_link(struct net_device *dev) |
drivers/staging/wlags49_h2/wl_netdev.c
... | ... | @@ -457,17 +457,17 @@ |
457 | 457 | |
458 | 458 | static void wl_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info) |
459 | 459 | { |
460 | - strncpy(info->driver, DRIVER_NAME, sizeof(info->driver) - 1); | |
461 | - strncpy(info->version, DRV_VERSION_STR, sizeof(info->version) - 1); | |
462 | -// strncpy(info.fw_version, priv->fw_name, | |
463 | -// sizeof(info.fw_version) - 1); | |
460 | + strlcpy(info->driver, DRIVER_NAME, sizeof(info->driver)); | |
461 | + strlcpy(info->version, DRV_VERSION_STR, sizeof(info->version)); | |
462 | +// strlcpy(info.fw_version, priv->fw_name, | |
463 | +// sizeof(info.fw_version)); | |
464 | 464 | |
465 | 465 | if (dev->dev.parent) { |
466 | 466 | dev_set_name(dev->dev.parent, "%s", info->bus_info); |
467 | - //strncpy(info->bus_info, dev->dev.parent->bus_id, | |
468 | - // sizeof(info->bus_info) - 1); | |
467 | + //strlcpy(info->bus_info, dev->dev.parent->bus_id, | |
468 | + // sizeof(info->bus_info)); | |
469 | 469 | } else { |
470 | - snprintf(info->bus_info, sizeof(info->bus_info) - 1, | |
470 | + snprintf(info->bus_info, sizeof(info->bus_info), | |
471 | 471 | "PCMCIA FIXME"); |
472 | 472 | // "PCMCIA 0x%lx", priv->hw.iobase); |
473 | 473 | } |
drivers/usb/gadget/u_ether.c
... | ... | @@ -159,12 +159,12 @@ |
159 | 159 | |
160 | 160 | static void eth_get_drvinfo(struct net_device *net, struct ethtool_drvinfo *p) |
161 | 161 | { |
162 | - struct eth_dev *dev = netdev_priv(net); | |
162 | + struct eth_dev *dev = netdev_priv(net); | |
163 | 163 | |
164 | - strlcpy(p->driver, "g_ether", sizeof p->driver); | |
165 | - strlcpy(p->version, UETH__VERSION, sizeof p->version); | |
166 | - strlcpy(p->fw_version, dev->gadget->name, sizeof p->fw_version); | |
167 | - strlcpy(p->bus_info, dev_name(&dev->gadget->dev), sizeof p->bus_info); | |
164 | + strlcpy(p->driver, "g_ether", sizeof(p->driver)); | |
165 | + strlcpy(p->version, UETH__VERSION, sizeof(p->version)); | |
166 | + strlcpy(p->fw_version, dev->gadget->name, sizeof(p->fw_version)); | |
167 | + strlcpy(p->bus_info, dev_name(&dev->gadget->dev), sizeof(p->bus_info)); | |
168 | 168 | } |
169 | 169 | |
170 | 170 | /* REVISIT can also support: |
net/8021q/vlan_dev.c
... | ... | @@ -640,9 +640,9 @@ |
640 | 640 | static void vlan_ethtool_get_drvinfo(struct net_device *dev, |
641 | 641 | struct ethtool_drvinfo *info) |
642 | 642 | { |
643 | - strcpy(info->driver, vlan_fullname); | |
644 | - strcpy(info->version, vlan_version); | |
645 | - strcpy(info->fw_version, "N/A"); | |
643 | + strlcpy(info->driver, vlan_fullname, sizeof(info->driver)); | |
644 | + strlcpy(info->version, vlan_version, sizeof(info->version)); | |
645 | + strlcpy(info->fw_version, "N/A", sizeof(info->fw_version)); | |
646 | 646 | } |
647 | 647 | |
648 | 648 | static struct rtnl_link_stats64 *vlan_dev_get_stats64(struct net_device *dev, struct rtnl_link_stats64 *stats) |
net/batman-adv/soft-interface.c
... | ... | @@ -580,10 +580,10 @@ |
580 | 580 | static void batadv_get_drvinfo(struct net_device *dev, |
581 | 581 | struct ethtool_drvinfo *info) |
582 | 582 | { |
583 | - strcpy(info->driver, "B.A.T.M.A.N. advanced"); | |
584 | - strcpy(info->version, BATADV_SOURCE_VERSION); | |
585 | - strcpy(info->fw_version, "N/A"); | |
586 | - strcpy(info->bus_info, "batman"); | |
583 | + strlcpy(info->driver, "B.A.T.M.A.N. advanced", sizeof(info->driver)); | |
584 | + strlcpy(info->version, BATADV_SOURCE_VERSION, sizeof(info->version)); | |
585 | + strlcpy(info->fw_version, "N/A", sizeof(info->fw_version)); | |
586 | + strlcpy(info->bus_info, "batman", sizeof(info->bus_info)); | |
587 | 587 | } |
588 | 588 | |
589 | 589 | static u32 batadv_get_msglevel(struct net_device *dev) |
net/bridge/br_device.c
... | ... | @@ -184,10 +184,10 @@ |
184 | 184 | |
185 | 185 | static void br_getinfo(struct net_device *dev, struct ethtool_drvinfo *info) |
186 | 186 | { |
187 | - strcpy(info->driver, "bridge"); | |
188 | - strcpy(info->version, BR_VERSION); | |
189 | - strcpy(info->fw_version, "N/A"); | |
190 | - strcpy(info->bus_info, "N/A"); | |
187 | + strlcpy(info->driver, "bridge", sizeof(info->driver)); | |
188 | + strlcpy(info->version, BR_VERSION, sizeof(info->version)); | |
189 | + strlcpy(info->fw_version, "N/A", sizeof(info->fw_version)); | |
190 | + strlcpy(info->bus_info, "N/A", sizeof(info->bus_info)); | |
191 | 191 | } |
192 | 192 | |
193 | 193 | static netdev_features_t br_fix_features(struct net_device *dev, |
net/dsa/slave.c
... | ... | @@ -203,10 +203,10 @@ |
203 | 203 | static void dsa_slave_get_drvinfo(struct net_device *dev, |
204 | 204 | struct ethtool_drvinfo *drvinfo) |
205 | 205 | { |
206 | - strncpy(drvinfo->driver, "dsa", 32); | |
207 | - strncpy(drvinfo->version, dsa_driver_version, 32); | |
208 | - strncpy(drvinfo->fw_version, "N/A", 32); | |
209 | - strncpy(drvinfo->bus_info, "platform", 32); | |
206 | + strlcpy(drvinfo->driver, "dsa", sizeof(drvinfo->driver)); | |
207 | + strlcpy(drvinfo->version, dsa_driver_version, sizeof(drvinfo->version)); | |
208 | + strlcpy(drvinfo->fw_version, "N/A", sizeof(drvinfo->fw_version)); | |
209 | + strlcpy(drvinfo->bus_info, "platform", sizeof(drvinfo->bus_info)); | |
210 | 210 | } |
211 | 211 | |
212 | 212 | static int dsa_slave_nway_reset(struct net_device *dev) |
net/openvswitch/vport-internal_dev.c
... | ... | @@ -97,7 +97,7 @@ |
97 | 97 | static void internal_dev_getinfo(struct net_device *netdev, |
98 | 98 | struct ethtool_drvinfo *info) |
99 | 99 | { |
100 | - strcpy(info->driver, "openvswitch"); | |
100 | + strlcpy(info->driver, "openvswitch", sizeof(info->driver)); | |
101 | 101 | } |
102 | 102 | |
103 | 103 | static const struct ethtool_ops internal_dev_ethtool_ops = { |
net/wireless/ethtool.c
... | ... | @@ -15,10 +15,10 @@ |
15 | 15 | strlcpy(info->version, init_utsname()->release, sizeof(info->version)); |
16 | 16 | |
17 | 17 | if (wdev->wiphy->fw_version[0]) |
18 | - strncpy(info->fw_version, wdev->wiphy->fw_version, | |
18 | + strlcpy(info->fw_version, wdev->wiphy->fw_version, | |
19 | 19 | sizeof(info->fw_version)); |
20 | 20 | else |
21 | - strncpy(info->fw_version, "N/A", sizeof(info->fw_version)); | |
21 | + strlcpy(info->fw_version, "N/A", sizeof(info->fw_version)); | |
22 | 22 | |
23 | 23 | strlcpy(info->bus_info, dev_name(wiphy_dev(wdev->wiphy)), |
24 | 24 | sizeof(info->bus_info)); |