ethtool: fix drvinfo strings set in drivers
authorJiri Pirko <jiri@resnulli.us>
Sun, 6 Jan 2013 00:44:26 +0000 (00:44 +0000)
committerDavid S. Miller <davem@davemloft.net>
Mon, 7 Jan 2013 05:06:31 +0000 (21:06 -0800)
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>
86 files changed:
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

index fd9090df64b631b3e5a77743028756c558fa5832..d8926c30362946475822ff21ca6a4d5dc9f20cbf 100644 (file)
@@ -274,8 +274,8 @@ static void uml_net_poll_controller(struct net_device *dev)
 static void uml_net_get_drvinfo(struct net_device *dev,
                                struct ethtool_drvinfo *info)
 {
-       strcpy(info->driver, DRIVER_NAME);
-       strcpy(info->version, "42");
+       strlcpy(info->driver, DRIVER_NAME, sizeof(info->driver));
+       strlcpy(info->version, "42", sizeof(info->version));
 }
 
 static const struct ethtool_ops uml_net_ethtool_ops = {
index 9542e1644a5c1beff7559da4096d734912193209..177cf76647268a0d527a6f4cc2c1a62d1b2ec135 100644 (file)
@@ -1317,11 +1317,13 @@ static void nes_netdev_get_drvinfo(struct net_device *netdev,
        struct nes_vnic *nesvnic = netdev_priv(netdev);
        struct nes_adapter *nesadapter = nesvnic->nesdev->nesadapter;
 
-       strcpy(drvinfo->driver, DRV_NAME);
-       strcpy(drvinfo->bus_info, pci_name(nesvnic->nesdev->pcidev));
-       sprintf(drvinfo->fw_version, "%u.%u", nesadapter->firmware_version>>16,
-                               nesadapter->firmware_version & 0x000000ff);
-       strcpy(drvinfo->version, DRV_VERSION);
+       strlcpy(drvinfo->driver, DRV_NAME, sizeof(drvinfo->driver));
+       strlcpy(drvinfo->bus_info, pci_name(nesvnic->nesdev->pcidev),
+               sizeof(drvinfo->bus_info));
+       snprintf(drvinfo->fw_version, sizeof(drvinfo->fw_version),
+                "%u.%u", nesadapter->firmware_version >> 16,
+                nesadapter->firmware_version & 0x000000ff);
+       strlcpy(drvinfo->version, DRV_VERSION, sizeof(drvinfo->version));
        drvinfo->testinfo_len = 0;
        drvinfo->eedump_len = 0;
        drvinfo->regdump_len = 0;
index 29bc7b5724aceb8746f8444fbbbae506abbea244..ca131335417b6e80c6b559f00ee22c53ed65bf9c 100644 (file)
@@ -39,7 +39,7 @@
 static void ipoib_get_drvinfo(struct net_device *netdev,
                              struct ethtool_drvinfo *drvinfo)
 {
-       strncpy(drvinfo->driver, "ipoib", sizeof(drvinfo->driver) - 1);
+       strlcpy(drvinfo->driver, "ipoib", sizeof(drvinfo->driver));
 }
 
 static int ipoib_get_coalesce(struct net_device *dev,
index c4952985c0847353bed692256c83bd39f4d7e07b..564cf4231f48a09246ae30a518983fcb6fa0a822 100644 (file)
@@ -4330,11 +4330,12 @@ void bond_set_mode_ops(struct bonding *bond, int mode)
 }
 
 static void bond_ethtool_get_drvinfo(struct net_device *bond_dev,
-                                   struct ethtool_drvinfo *drvinfo)
+                                    struct ethtool_drvinfo *drvinfo)
 {
-       strncpy(drvinfo->driver, DRV_NAME, 32);
-       strncpy(drvinfo->version, DRV_VERSION, 32);
-       snprintf(drvinfo->fw_version, 32, "%d", BOND_ABI_VERSION);
+       strlcpy(drvinfo->driver, DRV_NAME, sizeof(drvinfo->driver));
+       strlcpy(drvinfo->version, DRV_VERSION, sizeof(drvinfo->version));
+       snprintf(drvinfo->fw_version, sizeof(drvinfo->fw_version), "%d",
+                BOND_ABI_VERSION);
 }
 
 static const struct ethtool_ops bond_ethtool_ops = {
index 021d69c5d9bc951797ede8e72dde15bad706613b..29e272cc7a984f79cc3d6815b76deacb18b70abb 100644 (file)
@@ -1448,10 +1448,10 @@ static int e100_set_settings(struct net_device *dev,
 static void e100_get_drvinfo(struct net_device *dev,
                             struct ethtool_drvinfo *info)
 {
-       strncpy(info->driver, "ETRAX 100LX", sizeof(info->driver) - 1);
-       strncpy(info->version, "$Revision: 1.31 $", sizeof(info->version) - 1);
-       strncpy(info->fw_version, "N/A", sizeof(info->fw_version) - 1);
-       strncpy(info->bus_info, "N/A", sizeof(info->bus_info) - 1);
+       strlcpy(info->driver, "ETRAX 100LX", sizeof(info->driver));
+       strlcpy(info->version, "$Revision: 1.31 $", sizeof(info->version));
+       strlcpy(info->fw_version, "N/A", sizeof(info->fw_version));
+       strlcpy(info->bus_info, "N/A", sizeof(info->bus_info));
 }
 
 static int e100_nway_reset(struct net_device *dev)
index 2038eaabaea46323f46cfb40537dc0ff14f6b76c..9abd9a738f8e5f0b09575191147d79d57ff698be 100644 (file)
@@ -823,9 +823,10 @@ static void set_multicast_list(struct net_device *dev)
 static void netdev_get_drvinfo(struct net_device *dev,
                               struct ethtool_drvinfo *info)
 {
-       strcpy(info->driver, DRV_NAME);
-       strcpy(info->version, DRV_VERSION);
-       sprintf(info->bus_info, "ISA 0x%lx", dev->base_addr);
+       strlcpy(info->driver, DRV_NAME, sizeof(info->driver));
+       strlcpy(info->version, DRV_VERSION, sizeof(info->version));
+       snprintf(info->bus_info, sizeof(info->bus_info), "ISA 0x%lx",
+                dev->base_addr);
 }
 
 static u32 netdev_get_msglevel(struct net_device *dev)
index 633c709b9d996943c415cd0ad49e628a200eec34..f36ff99fd394e8491f4442a195b7fa18cff531ed 100644 (file)
@@ -1161,8 +1161,8 @@ el3_netdev_set_ecmd(struct net_device *dev, struct ethtool_cmd *ecmd)
 
 static void el3_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info)
 {
-       strcpy(info->driver, DRV_NAME);
-       strcpy(info->version, DRV_VERSION);
+       strlcpy(info->driver, DRV_NAME, sizeof(info->driver));
+       strlcpy(info->version, DRV_VERSION, sizeof(info->version));
 }
 
 static int el3_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
index 59e1e001bc3f538d67f210a46646283890e8832b..94c656f5a05ddbe9a09e505009466961a8e119a2 100644 (file)
@@ -1542,9 +1542,10 @@ static void set_rx_mode(struct net_device *dev)
 static void netdev_get_drvinfo(struct net_device *dev,
                               struct ethtool_drvinfo *info)
 {
-       strcpy(info->driver, DRV_NAME);
-       strcpy(info->version, DRV_VERSION);
-       sprintf(info->bus_info, "ISA 0x%lx", dev->base_addr);
+       strlcpy(info->driver, DRV_NAME, sizeof(info->driver));
+       strlcpy(info->version, DRV_VERSION, sizeof(info->version));
+       snprintf(info->bus_info, sizeof(info->bus_info), "ISA 0x%lx",
+                dev->base_addr);
 }
 
 static u32 netdev_get_msglevel(struct net_device *dev)
index 49d76bd0dc86fb12bc7a519fdc5a14d5a6eded82..0e9afe7b61a4e2f724b3e18383fde1b0bbda009d 100644 (file)
@@ -695,9 +695,10 @@ el2_block_input(struct net_device *dev, int count, struct sk_buff *skb, int ring
 static void netdev_get_drvinfo(struct net_device *dev,
                               struct ethtool_drvinfo *info)
 {
-       strcpy(info->driver, DRV_NAME);
-       strcpy(info->version, DRV_VERSION);
-       sprintf(info->bus_info, "ISA 0x%lx", dev->base_addr);
+       strlcpy(info->driver, DRV_NAME, sizeof(info->driver));
+       strlcpy(info->version, DRV_VERSION, sizeof(info->version));
+       snprintf(info->bus_info, sizeof(info->bus_info), "ISA 0x%lx",
+                dev->base_addr);
 }
 
 static const struct ethtool_ops netdev_ethtool_ops = {
index 70dba5d01ad3cc8178318f9976a5922894a86859..7eeddf01307f14d81ff43bae8979d43ba7b595c6 100644 (file)
@@ -469,9 +469,9 @@ static void ax_get_drvinfo(struct net_device *dev,
 {
        struct platform_device *pdev = to_platform_device(dev->dev.parent);
 
-       strcpy(info->driver, DRV_NAME);
-       strcpy(info->version, DRV_VERSION);
-       strcpy(info->bus_info, pdev->name);
+       strlcpy(info->driver, DRV_NAME, sizeof(info->driver));
+       strlcpy(info->version, DRV_VERSION, sizeof(info->version));
+       strlcpy(info->bus_info, pdev->name, sizeof(info->bus_info));
 }
 
 static int ax_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
index 8c3c9cfbf8649c13421175063465b7004505bc52..c7a83f6f2382cf7f8095e99f2af24af23da5cf94 100644 (file)
@@ -498,10 +498,10 @@ bfin_mac_ethtool_setsettings(struct net_device *dev, struct ethtool_cmd *cmd)
 static void bfin_mac_ethtool_getdrvinfo(struct net_device *dev,
                                        struct ethtool_drvinfo *info)
 {
-       strcpy(info->driver, KBUILD_MODNAME);
-       strcpy(info->version, DRV_VERSION);
-       strcpy(info->fw_version, "N/A");
-       strcpy(info->bus_info, dev_name(&dev->dev));
+       strlcpy(info->driver, KBUILD_MODNAME, sizeof(info->driver));
+       strlcpy(info->version, DRV_VERSION, sizeof(info->version));
+       strlcpy(info->fw_version, "N/A", sizeof(info->fw_version));
+       strlcpy(info->bus_info, dev_name(&dev->dev), sizeof(info->bus_info));
 }
 
 static void bfin_mac_ethtool_getwol(struct net_device *dev,
index aa53115bb38b91d45329be5914241591da6776c7..480662ba5227a44588f0e4ef05f35767548cf084 100644 (file)
@@ -1127,10 +1127,11 @@ static void greth_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *in
 {
        struct greth_private *greth = netdev_priv(dev);
 
-       strncpy(info->driver, dev_driver_string(greth->dev), 32);
-       strncpy(info->version, "revision: 1.0", 32);
-       strncpy(info->bus_info, greth->dev->bus->name, 32);
-       strncpy(info->fw_version, "N/A", 32);
+       strlcpy(info->driver, dev_driver_string(greth->dev),
+               sizeof(info->driver));
+       strlcpy(info->version, "revision: 1.0", sizeof(info->version));
+       strlcpy(info->bus_info, greth->dev->bus->name, sizeof(info->bus_info));
+       strlcpy(info->fw_version, "N/A", sizeof(info->fw_version));
        info->eedump_len = 0;
        info->regdump_len = sizeof(struct greth_regs);
 }
index 2ea221ed4777f01527a81d08d299dcf44a3b6b8f..65b865a0cc78f2bb2e8ee0bb4d2103a08aa67b64 100644 (file)
@@ -587,10 +587,10 @@ au1000_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info)
 {
        struct au1000_private *aup = netdev_priv(dev);
 
-       strcpy(info->driver, DRV_NAME);
-       strcpy(info->version, DRV_VERSION);
-       info->fw_version[0] = '\0';
-       sprintf(info->bus_info, "%s %d", DRV_NAME, aup->mac_id);
+       strlcpy(info->driver, DRV_NAME, sizeof(info->driver));
+       strlcpy(info->version, DRV_VERSION, sizeof(info->version));
+       snprintf(info->bus_info, sizeof(info->bus_info), "%s %d", DRV_NAME,
+                aup->mac_id);
        info->regdump_len = 0;
 }
 
index c2d696c88e4687c46233b017429f2fc86c9aca8f..6a40290d3727579f2a3fd0b1009e5ef3d2323e06 100644 (file)
@@ -1284,8 +1284,8 @@ static void lance_free_hwresources(struct lance_private *lp)
 /* Ethtool support... */
 static void sparc_lance_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info)
 {
-       strcpy(info->driver, "sunlance");
-       strcpy(info->version, "2.02");
+       strlcpy(info->driver, "sunlance", sizeof(info->driver));
+       strlcpy(info->version, "2.02", sizeof(info->version));
 }
 
 static const struct ethtool_ops sparc_lance_ethtool_ops = {
index 39387d67b7222beee3a5fd122218c645851f90c6..d8a151046728c55a41076502caf5b5682c1de9f8 100644 (file)
@@ -1227,10 +1227,11 @@ static const u32 unused_mib_regs[] = {
 static void bcm_enet_get_drvinfo(struct net_device *netdev,
                                 struct ethtool_drvinfo *drvinfo)
 {
-       strncpy(drvinfo->driver, bcm_enet_driver_name, 32);
-       strncpy(drvinfo->version, bcm_enet_driver_version, 32);
-       strncpy(drvinfo->fw_version, "N/A", 32);
-       strncpy(drvinfo->bus_info, "bcm63xx", 32);
+       strlcpy(drvinfo->driver, bcm_enet_driver_name, sizeof(drvinfo->driver));
+       strlcpy(drvinfo->version, bcm_enet_driver_version,
+               sizeof(drvinfo->version));
+       strlcpy(drvinfo->fw_version, "N/A", sizeof(drvinfo->fw_version));
+       strlcpy(drvinfo->bus_info, "bcm63xx", sizeof(drvinfo->bus_info));
        drvinfo->n_stats = BCM_ENET_STATS_LEN;
 }
 
index 78c55213eaf7c59e9a865fc48942c112a6e2f7c0..354cbb78ed507876c3f7c54f735e2791a4a6d32a 100644 (file)
@@ -710,8 +710,8 @@ static int ep93xx_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
 
 static void ep93xx_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info)
 {
-       strcpy(info->driver, DRV_MODULE_NAME);
-       strcpy(info->version, DRV_MODULE_VERSION);
+       strlcpy(info->driver, DRV_MODULE_NAME, sizeof(info->driver));
+       strlcpy(info->version, DRV_MODULE_VERSION, sizeof(info->version));
 }
 
 static int ep93xx_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
index c73472c369cd6e7334e42baf3d61f15952ece55a..8cdf02503d13d5bdd52348f77995c0ce47618f1c 100644 (file)
@@ -434,9 +434,10 @@ static void dm9000_get_drvinfo(struct net_device *dev,
 {
        board_info_t *dm = to_dm9000_board(dev);
 
-       strcpy(info->driver, CARDNAME);
-       strcpy(info->version, DRV_VERSION);
-       strcpy(info->bus_info, to_platform_device(dm->dev)->name);
+       strlcpy(info->driver, CARDNAME, sizeof(info->driver));
+       strlcpy(info->version, DRV_VERSION, sizeof(info->version));
+       strlcpy(info->bus_info, to_platform_device(dm->dev)->name,
+               sizeof(info->bus_info));
 }
 
 static u32 dm9000_get_msglevel(struct net_device *dev)
index 9f992b95eddc1b13209082890f13d1d9a8248964..501517226f63f1d4b09df7bb24bb461b34b8456d 100644 (file)
@@ -1506,10 +1506,10 @@ static void ewrk3_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *in
 {
        int fwrev = Read_EEPROM(dev->base_addr, EEPROM_REVLVL);
 
-       strcpy(info->driver, DRV_NAME);
-       strcpy(info->version, DRV_VERSION);
-       sprintf(info->fw_version, "%d", fwrev);
-       strcpy(info->bus_info, "N/A");
+       strlcpy(info->driver, DRV_NAME, sizeof(info->driver));
+       strlcpy(info->version, DRV_VERSION, sizeof(info->version));
+       snprintf(info->fw_version, sizeof(info->fw_version), "%d", fwrev);
+       strlcpy(info->bus_info, "N/A", sizeof(info->bus_info));
        info->eedump_len = EEPROM_MAX;
 }
 
index 1d342d37915cd1d45b8c00088079e6aef2b273fc..110d26f4c6028f37d773576d4dd3a5a2d13fd5b3 100644 (file)
@@ -1156,9 +1156,10 @@ set_multicast (struct net_device *dev)
 static void rio_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info)
 {
        struct netdev_private *np = netdev_priv(dev);
-       strcpy(info->driver, "dl2k");
-       strcpy(info->version, DRV_VERSION);
-       strcpy(info->bus_info, pci_name(np->pdev));
+
+       strlcpy(info->driver, "dl2k", sizeof(info->driver));
+       strlcpy(info->version, DRV_VERSION, sizeof(info->version));
+       strlcpy(info->bus_info, pci_name(np->pdev), sizeof(info->bus_info));
 }
 
 static int rio_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
index 00454a10f88d6111f5bfb30987703c04d807e8ba..76b302f30c8727fe638a8e9783f8246c037f1db6 100644 (file)
@@ -183,12 +183,12 @@ static void be_get_drvinfo(struct net_device *netdev,
 
        strlcpy(drvinfo->driver, DRV_NAME, sizeof(drvinfo->driver));
        strlcpy(drvinfo->version, DRV_VER, sizeof(drvinfo->version));
-       strncpy(drvinfo->fw_version, adapter->fw_ver, FW_VER_LEN);
-       if (memcmp(adapter->fw_ver, fw_on_flash, FW_VER_LEN) != 0) {
-               strcat(drvinfo->fw_version, " [");
-               strcat(drvinfo->fw_version, fw_on_flash);
-               strcat(drvinfo->fw_version, "]");
-       }
+       if (!memcmp(adapter->fw_ver, fw_on_flash, FW_VER_LEN))
+               strlcpy(drvinfo->fw_version, adapter->fw_ver,
+                       sizeof(drvinfo->fw_version));
+       else
+               snprintf(drvinfo->fw_version, sizeof(drvinfo->fw_version),
+                        "%s [%s]", adapter->fw_ver, fw_on_flash);
 
        strlcpy(drvinfo->bus_info, pci_name(adapter->pdev),
                sizeof(drvinfo->bus_info));
index 74d749e29aab7725888ec8a273b5ecdd4522dc06..96454b5fca634df8adbe7307b04e39b062b7352d 100644 (file)
@@ -955,9 +955,9 @@ static int ftgmac100_mdiobus_reset(struct mii_bus *bus)
 static void ftgmac100_get_drvinfo(struct net_device *netdev,
                                  struct ethtool_drvinfo *info)
 {
-       strcpy(info->driver, DRV_NAME);
-       strcpy(info->version, DRV_VERSION);
-       strcpy(info->bus_info, dev_name(&netdev->dev));
+       strlcpy(info->driver, DRV_NAME, sizeof(info->driver));
+       strlcpy(info->version, DRV_VERSION, sizeof(info->version));
+       strlcpy(info->bus_info, dev_name(&netdev->dev), sizeof(info->bus_info));
 }
 
 static int ftgmac100_get_settings(struct net_device *netdev,
index b901a01e3fa5073f4b5c8039d94cf04c7beaa849..b5ea8fbd8a76d19597714b8e35772e9037647a86 100644 (file)
@@ -820,9 +820,9 @@ static void ftmac100_mdio_write(struct net_device *netdev, int phy_id, int reg,
 static void ftmac100_get_drvinfo(struct net_device *netdev,
                                 struct ethtool_drvinfo *info)
 {
-       strcpy(info->driver, DRV_NAME);
-       strcpy(info->version, DRV_VERSION);
-       strcpy(info->bus_info, dev_name(&netdev->dev));
+       strlcpy(info->driver, DRV_NAME, sizeof(info->driver));
+       strlcpy(info->version, DRV_VERSION, sizeof(info->version));
+       strlcpy(info->bus_info, dev_name(&netdev->dev), sizeof(info->bus_info));
 }
 
 static int ftmac100_get_settings(struct net_device *netdev, struct ethtool_cmd *cmd)
index a3793190437fa1b3a4b4abd7721ca5c66916ed67..0a9748b64c24ba48a670da452e87e9e6a6c819cb 100644 (file)
@@ -1168,9 +1168,10 @@ static void fec_enet_get_drvinfo(struct net_device *ndev,
 {
        struct fec_enet_private *fep = netdev_priv(ndev);
 
-       strcpy(info->driver, fep->pdev->dev.driver->name);
-       strcpy(info->version, "Revision: 1.0");
-       strcpy(info->bus_info, dev_name(&ndev->dev));
+       strlcpy(info->driver, fep->pdev->dev.driver->name,
+               sizeof(info->driver));
+       strlcpy(info->version, "Revision: 1.0", sizeof(info->version));
+       strlcpy(info->bus_info, dev_name(&ndev->dev), sizeof(info->bus_info));
 }
 
 static const struct ethtool_ops fec_enet_ethtool_ops = {
index e9879c5af7ba05dcea3364fb3db9c13d028998eb..46df28893c10649e0de42354671559b37bfef0c2 100644 (file)
@@ -888,8 +888,8 @@ static struct net_device_stats *fs_enet_get_stats(struct net_device *dev)
 static void fs_get_drvinfo(struct net_device *dev,
                            struct ethtool_drvinfo *info)
 {
-       strcpy(info->driver, DRV_MODULE_NAME);
-       strcpy(info->version, DRV_MODULE_VERSION);
+       strlcpy(info->driver, DRV_MODULE_NAME, sizeof(info->driver));
+       strlcpy(info->version, DRV_MODULE_VERSION, sizeof(info->version));
 }
 
 static int fs_get_regs_len(struct net_device *dev)
index 22eabc13ca99df900587678c24003167636446d3..1b6a67cf8bf636e9a63bfc213549ac15ec3c29dd 100644 (file)
@@ -649,8 +649,6 @@ struct gfar_extra_stats {
 /* Number of stats in the stats structure (ignore car and cam regs)*/
 #define GFAR_STATS_LEN (GFAR_RMON_LEN + GFAR_EXTRA_STATS_LEN)
 
-#define GFAR_INFOSTR_LEN 32
-
 struct gfar_stats {
        u64 extra[GFAR_EXTRA_STATS_LEN];
        u64 rmon[GFAR_RMON_LEN];
index ab6762caa95702f492bbb457deae8986257bdcc4..d0fe53c5b297b0efdfa982d2af63691afa4260da 100644 (file)
@@ -184,10 +184,11 @@ static int gfar_sset_count(struct net_device *dev, int sset)
 static void gfar_gdrvinfo(struct net_device *dev,
                          struct ethtool_drvinfo *drvinfo)
 {
-       strncpy(drvinfo->driver, DRV_NAME, GFAR_INFOSTR_LEN);
-       strncpy(drvinfo->version, gfar_driver_version, GFAR_INFOSTR_LEN);
-       strncpy(drvinfo->fw_version, "N/A", GFAR_INFOSTR_LEN);
-       strncpy(drvinfo->bus_info, "N/A", GFAR_INFOSTR_LEN);
+       strlcpy(drvinfo->driver, DRV_NAME, sizeof(drvinfo->driver));
+       strlcpy(drvinfo->version, gfar_driver_version,
+               sizeof(drvinfo->version));
+       strlcpy(drvinfo->fw_version, "N/A", sizeof(drvinfo->fw_version));
+       strlcpy(drvinfo->bus_info, "N/A", sizeof(drvinfo->bus_info));
        drvinfo->regdump_len = 0;
        drvinfo->eedump_len = 0;
 }
index 37b035306013a0ac443040594177424e44a8422b..1ebf7128ec04da37a2236f41848bdad8b10162de 100644 (file)
@@ -350,10 +350,10 @@ static void
 uec_get_drvinfo(struct net_device *netdev,
                        struct ethtool_drvinfo *drvinfo)
 {
-       strncpy(drvinfo->driver, DRV_NAME, 32);
-       strncpy(drvinfo->version, DRV_VERSION, 32);
-       strncpy(drvinfo->fw_version, "N/A", 32);
-       strncpy(drvinfo->bus_info, "QUICC ENGINE", 32);
+       strlcpy(drvinfo->driver, DRV_NAME, sizeof(drvinfo->driver));
+       strlcpy(drvinfo->version, DRV_VERSION, sizeof(drvinfo->version));
+       strlcpy(drvinfo->fw_version, "N/A", sizeof(drvinfo->fw_version));
+       strlcpy(drvinfo->bus_info, "QUICC ENGINE", sizeof(drvinfo->bus_info));
        drvinfo->eedump_len = 0;
        drvinfo->regdump_len = uec_get_regs_len(netdev);
 }
index 6a5c21b82c511563b48ef9e807fab0e6b8ae5e2a..6d000d678a58188bd570150b1aa6968d85ec6e05 100644 (file)
@@ -1138,9 +1138,10 @@ static struct net_device_stats *elp_get_stats(struct net_device *dev)
 static void netdev_get_drvinfo(struct net_device *dev,
                               struct ethtool_drvinfo *info)
 {
-       strcpy(info->driver, DRV_NAME);
-       strcpy(info->version, DRV_VERSION);
-       sprintf(info->bus_info, "ISA 0x%lx", dev->base_addr);
+       strlcpy(info->driver, DRV_NAME, sizeof(info->driver));
+       strlcpy(info->version, DRV_VERSION, sizeof(info->version));
+       snprintf(info->bus_info, sizeof(info->bus_info), "ISA 0x%lx",
+                dev->base_addr);
 }
 
 static u32 netdev_get_msglevel(struct net_device *dev)
index e8984b05990527665cb283eb270fa70f63fa6bdb..13983ee6bcf8806b8e11da9c3e434165cf47ae14 100644 (file)
@@ -888,9 +888,10 @@ static void el16_rx(struct net_device *dev)
 static void netdev_get_drvinfo(struct net_device *dev,
                               struct ethtool_drvinfo *info)
 {
-       strcpy(info->driver, DRV_NAME);
-       strcpy(info->version, DRV_VERSION);
-       sprintf(info->bus_info, "ISA 0x%lx", dev->base_addr);
+       strlcpy(info->driver, DRV_NAME, sizeof(info->driver));
+       strlcpy(info->version, DRV_VERSION, sizeof(info->version));
+       snprintf(info->bus_info, sizeof(info->bus_info), "ISA 0x%lx",
+                dev->base_addr);
 }
 
 static u32 netdev_get_msglevel(struct net_device *dev)
index 256bdb8e19948390eeb4e73513b475e377350849..4989481c19f01b6dad9b560b535b6127da416eee 100644 (file)
@@ -2190,11 +2190,10 @@ static void emac_ethtool_get_drvinfo(struct net_device *ndev,
 {
        struct emac_instance *dev = netdev_priv(ndev);
 
-       strcpy(info->driver, "ibm_emac");
-       strcpy(info->version, DRV_VERSION);
-       info->fw_version[0] = '\0';
-       sprintf(info->bus_info, "PPC 4xx EMAC-%d %s",
-               dev->cell_index, dev->ofdev->dev.of_node->full_name);
+       strlcpy(info->driver, "ibm_emac", sizeof(info->driver));
+       strlcpy(info->version, DRV_VERSION, sizeof(info->version));
+       snprintf(info->bus_info, sizeof(info->bus_info), "PPC 4xx EMAC-%d %s",
+                dev->cell_index, dev->ofdev->dev.of_node->full_name);
        info->regdump_len = emac_ethtool_get_regs_len(ndev);
 }
 
index f2fdbb79837eafcc7baf00d070efb48251bd1f7a..4181f6e99c0003ba6f2ed1ae2055e0365dbd8e29 100644 (file)
@@ -722,9 +722,8 @@ static int netdev_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
 static void netdev_get_drvinfo(struct net_device *dev,
                               struct ethtool_drvinfo *info)
 {
-       strncpy(info->driver, ibmveth_driver_name, sizeof(info->driver) - 1);
-       strncpy(info->version, ibmveth_driver_version,
-               sizeof(info->version) - 1);
+       strlcpy(info->driver, ibmveth_driver_name, sizeof(info->driver));
+       strlcpy(info->version, ibmveth_driver_version, sizeof(info->version));
 }
 
 static netdev_features_t ibmveth_fix_features(struct net_device *dev,
index bc58f1dc22f50f204e7ec46045052999b0437d92..5409fe876a441607488d43ac39829f7e5fc9e891 100644 (file)
@@ -695,9 +695,9 @@ static void netdev_get_drvinfo(struct net_device *dev,
 {
        struct korina_private *lp = netdev_priv(dev);
 
-       strcpy(info->driver, DRV_NAME);
-       strcpy(info->version, DRV_VERSION);
-       strcpy(info->bus_info, lp->dev->name);
+       strlcpy(info->driver, DRV_NAME, sizeof(info->driver));
+       strlcpy(info->version, DRV_VERSION, sizeof(info->version));
+       strlcpy(info->bus_info, lp->dev->name, sizeof(info->bus_info));
 }
 
 static int netdev_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
index cd3d2c09cdd0b10f797e822ba689da7327690461..8ead46adc21e6f07913c996405bbc36a5927695c 100644 (file)
@@ -302,9 +302,9 @@ ltq_etop_hw_init(struct net_device *dev)
 static void
 ltq_etop_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info)
 {
-       strcpy(info->driver, "Lantiq ETOP");
-       strcpy(info->bus_info, "internal");
-       strcpy(info->version, DRV_VERSION);
+       strlcpy(info->driver, "Lantiq ETOP", sizeof(info->driver));
+       strlcpy(info->bus_info, "internal", sizeof(info->bus_info));
+       strlcpy(info->version, DRV_VERSION, sizeof(info->version));
 }
 
 static int
index aa037ca314e7d20188966c34773b5684badf4e1c..c7f2fa60fe6f221538c211955d1550721d529dc1 100644 (file)
@@ -1443,10 +1443,10 @@ static int pxa168_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
 static void pxa168_get_drvinfo(struct net_device *dev,
                               struct ethtool_drvinfo *info)
 {
-       strncpy(info->driver, DRIVER_NAME, 32);
-       strncpy(info->version, DRIVER_VERSION, 32);
-       strncpy(info->fw_version, "N/A", 32);
-       strncpy(info->bus_info, "N/A", 32);
+       strlcpy(info->driver, DRIVER_NAME, sizeof(info->driver));
+       strlcpy(info->version, DRIVER_VERSION, sizeof(info->version));
+       strlcpy(info->fw_version, "N/A", sizeof(info->fw_version));
+       strlcpy(info->bus_info, "N/A", sizeof(info->bus_info));
 }
 
 static const struct ethtool_ops pxa168_ethtool_ops = {
index 92dd72d3f9de39a70bb141848614753e7c23b4ba..f8f073880f84bccd5f0daedb8c1f08233c43e6c8 100644 (file)
@@ -82,9 +82,9 @@ static void vxge_ethtool_gdrvinfo(struct net_device *dev,
                                  struct ethtool_drvinfo *info)
 {
        struct vxgedev *vdev = netdev_priv(dev);
-       strlcpy(info->driver, VXGE_DRIVER_NAME, sizeof(VXGE_DRIVER_NAME));
-       strlcpy(info->version, DRV_VERSION, sizeof(DRV_VERSION));
-       strlcpy(info->fw_version, vdev->fw_version, VXGE_HW_FW_STRLEN);
+       strlcpy(info->driver, VXGE_DRIVER_NAME, sizeof(info->driver));
+       strlcpy(info->version, DRV_VERSION, sizeof(info->version));
+       strlcpy(info->fw_version, vdev->fw_version, sizeof(info->fw_version));
        strlcpy(info->bus_info, pci_name(vdev->pdev), sizeof(info->bus_info));
        info->regdump_len = sizeof(struct vxge_hw_vpath_reg)
                                * vdev->no_of_vpath;
index cbd6a529d0c0d94d130dfb16f8703db6c1139fb4..162da8975b059a3ef42ec9e2469660e02d3b01de 100644 (file)
@@ -878,8 +878,8 @@ static int w90p910_ether_ioctl(struct net_device *dev,
 static void w90p910_get_drvinfo(struct net_device *dev,
                                        struct ethtool_drvinfo *info)
 {
-       strcpy(info->driver, DRV_MODULE_NAME);
-       strcpy(info->version, DRV_MODULE_VERSION);
+       strlcpy(info->driver, DRV_MODULE_NAME, sizeof(info->driver));
+       strlcpy(info->version, DRV_MODULE_VERSION, sizeof(info->version));
 }
 
 static int w90p910_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
index 3466ca1e8f6c0c11edc26a06b86b83595ed014a0..6fda51ebcc765477bd0768c5829dadb0d73cd9e6 100644 (file)
@@ -1239,9 +1239,10 @@ static int lpc_eth_open(struct net_device *ndev)
 static void lpc_eth_ethtool_getdrvinfo(struct net_device *ndev,
        struct ethtool_drvinfo *info)
 {
-       strcpy(info->driver, MODNAME);
-       strcpy(info->version, DRV_VERSION);
-       strcpy(info->bus_info, dev_name(ndev->dev.parent));
+       strlcpy(info->driver, MODNAME, sizeof(info->driver));
+       strlcpy(info->version, DRV_VERSION, sizeof(info->version));
+       strlcpy(info->bus_info, dev_name(ndev->dev.parent),
+               sizeof(info->bus_info));
 }
 
 static u32 lpc_eth_ethtool_getmsglevel(struct net_device *ndev)
index b4a842c3b5c4a680dac0b9fa7100088eec9df890..921729f9c85c53baa17cd334f4a7b8f35f590561 100644 (file)
@@ -1350,10 +1350,10 @@ static void octeon_mgmt_poll_controller(struct net_device *netdev)
 static void octeon_mgmt_get_drvinfo(struct net_device *netdev,
                                    struct ethtool_drvinfo *info)
 {
-       strncpy(info->driver, DRV_NAME, sizeof(info->driver));
-       strncpy(info->version, DRV_VERSION, sizeof(info->version));
-       strncpy(info->fw_version, "N/A", sizeof(info->fw_version));
-       strncpy(info->bus_info, "N/A", sizeof(info->bus_info));
+       strlcpy(info->driver, DRV_NAME, sizeof(info->driver));
+       strlcpy(info->version, DRV_VERSION, sizeof(info->version));
+       strlcpy(info->fw_version, "N/A", sizeof(info->fw_version));
+       strlcpy(info->bus_info, "N/A", sizeof(info->bus_info));
        info->n_stats = 0;
        info->testinfo_len = 0;
        info->regdump_len = 0;
index bf829ee30077ac0b4716f6ca04101669aea549af..cac33e5f9bc2635cd2a4fd9b38c1af6f155164d8 100644 (file)
@@ -1808,9 +1808,10 @@ static int check_if_running(struct net_device *dev)
 static void hamachi_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info)
 {
        struct hamachi_private *np = netdev_priv(dev);
-       strcpy(info->driver, DRV_NAME);
-       strcpy(info->version, DRV_VERSION);
-       strcpy(info->bus_info, pci_name(np->pci_dev));
+
+       strlcpy(info->driver, DRV_NAME, sizeof(info->driver));
+       strlcpy(info->version, DRV_VERSION, sizeof(info->version));
+       strlcpy(info->bus_info, pci_name(np->pci_dev), sizeof(info->bus_info));
 }
 
 static int hamachi_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
index fbaed4fa72fa01798ec058b2381c9af381839eab..d28593b1fc3e8664b1f6aad8e6d53dba4fdd1a5c 100644 (file)
@@ -1326,9 +1326,10 @@ static void set_rx_mode(struct net_device *dev)
 static void yellowfin_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info)
 {
        struct yellowfin_private *np = netdev_priv(dev);
-       strcpy(info->driver, DRV_NAME);
-       strcpy(info->version, DRV_VERSION);
-       strcpy(info->bus_info, pci_name(np->pci_dev));
+
+       strlcpy(info->driver, DRV_NAME, sizeof(info->driver));
+       strlcpy(info->version, DRV_VERSION, sizeof(info->version));
+       strlcpy(info->bus_info, pci_name(np->pci_dev), sizeof(info->bus_info));
 }
 
 static const struct ethtool_ops ethtool_ops = {
index 63c13125db6c9d0a58dcc70438d4af4058bcfd1e..ba0be4b943ddff104cfaa06400bafcdaee8f3e51 100644 (file)
@@ -957,9 +957,9 @@ static void netdev_get_drvinfo(struct net_device *dev,
 {
        struct r6040_private *rp = netdev_priv(dev);
 
-       strcpy(info->driver, DRV_NAME);
-       strcpy(info->version, DRV_VERSION);
-       strcpy(info->bus_info, pci_name(rp->pdev));
+       strlcpy(info->driver, DRV_NAME, sizeof(info->driver));
+       strlcpy(info->version, DRV_VERSION, sizeof(info->version));
+       strlcpy(info->bus_info, pci_name(rp->pdev), sizeof(info->bus_info));
 }
 
 static int netdev_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
index dc171b4961e47f2a0b0b3247701da908d1dbd601..7ed08c32a9c512621665d14566e3371f24108398 100644 (file)
@@ -1565,9 +1565,9 @@ static void ioc3_get_drvinfo (struct net_device *dev,
 {
        struct ioc3_private *ip = netdev_priv(dev);
 
-        strcpy (info->driver, IOC3_NAME);
-        strcpy (info->version, IOC3_VERSION);
-        strcpy (info->bus_info, pci_name(ip->pdev));
+       strlcpy(info->driver, IOC3_NAME, sizeof(info->driver));
+       strlcpy(info->version, IOC3_VERSION, sizeof(info->version));
+       strlcpy(info->bus_info, pci_name(ip->pdev), sizeof(info->bus_info));
 }
 
 static int ioc3_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
index 59a6f88da8676154b34526aa42c0feb34314a014..1538d5442bab734c94402a155b7fd12d1974ab45 100644 (file)
@@ -1522,9 +1522,10 @@ smc911x_ethtool_setsettings(struct net_device *dev, struct ethtool_cmd *cmd)
 static void
 smc911x_ethtool_getdrvinfo(struct net_device *dev, struct ethtool_drvinfo *info)
 {
-       strncpy(info->driver, CARDNAME, sizeof(info->driver));
-       strncpy(info->version, version, sizeof(info->version));
-       strncpy(info->bus_info, dev_name(dev->dev.parent), sizeof(info->bus_info));
+       strlcpy(info->driver, CARDNAME, sizeof(info->driver));
+       strlcpy(info->version, version, sizeof(info->version));
+       strlcpy(info->bus_info, dev_name(dev->dev.parent),
+               sizeof(info->bus_info));
 }
 
 static int smc911x_ethtool_nwayreset(struct net_device *dev)
index a670d23d9340245ddcd4d573777c6c53151acb41..591650a8de3887942b4efeb78faa3e5ae3324039 100644 (file)
@@ -1597,9 +1597,10 @@ smc_ethtool_setsettings(struct net_device *dev, struct ethtool_cmd *cmd)
 static void
 smc_ethtool_getdrvinfo(struct net_device *dev, struct ethtool_drvinfo *info)
 {
-       strncpy(info->driver, CARDNAME, sizeof(info->driver));
-       strncpy(info->version, version, sizeof(info->version));
-       strncpy(info->bus_info, dev_name(dev->dev.parent), sizeof(info->bus_info));
+       strlcpy(info->driver, CARDNAME, sizeof(info->driver));
+       strlcpy(info->version, version, sizeof(info->version));
+       strlcpy(info->bus_info, dev_name(dev->dev.parent),
+               sizeof(info->bus_info));
 }
 
 static int smc_ethtool_nwayreset(struct net_device *dev)
index 1372ce210b58b60aa32325b08a8da2d93b5abb6e..d1ac39c1b05d2894ceaee0ed41aeb49f03b88a04 100644 (file)
@@ -210,8 +210,7 @@ static void stmmac_ethtool_getdrvinfo(struct net_device *dev,
                strlcpy(info->driver, MAC100_ETHTOOL_NAME,
                        sizeof(info->driver));
 
-       strcpy(info->version, DRV_MODULE_VERSION);
-       info->fw_version[0] = '\0';
+       strlcpy(info->version, DRV_MODULE_VERSION, sizeof(info->version));
 }
 
 static int stmmac_ethtool_getsettings(struct net_device *dev,
index be82f6d13c5199228053ca37a69f847821542f35..5fafca0653051d3960fc5240341ad0271ffeb832 100644 (file)
@@ -1042,8 +1042,8 @@ static void bigmac_set_multicast(struct net_device *dev)
 /* Ethtool support... */
 static void bigmac_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info)
 {
-       strcpy(info->driver, "sunbmac");
-       strcpy(info->version, "2.0");
+       strlcpy(info->driver, "sunbmac", sizeof(info->driver));
+       strlcpy(info->version, "2.0", sizeof(info->version));
 }
 
 static u32 bigmac_get_link(struct net_device *dev)
index 1dcee6915843cd67f11169eab68c36fbbeb51a4c..49bf3e2eb652316757e2781ef7e703171c868414 100644 (file)
@@ -685,13 +685,14 @@ static void qe_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info)
        struct sunqe *qep = netdev_priv(dev);
        struct platform_device *op;
 
-       strcpy(info->driver, "sunqe");
-       strcpy(info->version, "3.0");
+       strlcpy(info->driver, "sunqe", sizeof(info->driver));
+       strlcpy(info->version, "3.0", sizeof(info->version));
 
        op = qep->op;
        regs = of_get_property(op->dev.of_node, "reg", NULL);
        if (regs)
-               sprintf(info->bus_info, "SBUS:%d", regs->which_io);
+               snprintf(info->bus_info, sizeof(info->bus_info), "SBUS:%d",
+                        regs->which_io);
 
 }
 
index e1b8955308277fae7c953274492e3d9eb936f961..1cf767eb3ed555b3498c6119dd21795aa21a9247 100644 (file)
@@ -882,8 +882,8 @@ static int vnet_set_mac_addr(struct net_device *dev, void *p)
 static void vnet_get_drvinfo(struct net_device *dev,
                             struct ethtool_drvinfo *info)
 {
-       strcpy(info->driver, DRV_MODULE_NAME);
-       strcpy(info->version, DRV_MODULE_VERSION);
+       strlcpy(info->driver, DRV_MODULE_NAME, sizeof(info->driver));
+       strlcpy(info->version, DRV_MODULE_VERSION, sizeof(info->version));
 }
 
 static u32 vnet_get_msglevel(struct net_device *dev)
index 1e4d743ff03e7b86e0cd72002166f0dc28212b73..e15cc71b826de613ad6e304480306f903e9e6e2c 100644 (file)
@@ -2179,10 +2179,10 @@ bdx_get_drvinfo(struct net_device *netdev, struct ethtool_drvinfo *drvinfo)
 {
        struct bdx_priv *priv = netdev_priv(netdev);
 
-       strlcat(drvinfo->driver, BDX_DRV_NAME, sizeof(drvinfo->driver));
-       strlcat(drvinfo->version, BDX_DRV_VERSION, sizeof(drvinfo->version));
-       strlcat(drvinfo->fw_version, "N/A", sizeof(drvinfo->fw_version));
-       strlcat(drvinfo->bus_info, pci_name(priv->pdev),
+       strlcpy(drvinfo->driver, BDX_DRV_NAME, sizeof(drvinfo->driver));
+       strlcpy(drvinfo->version, BDX_DRV_VERSION, sizeof(drvinfo->version));
+       strlcpy(drvinfo->fw_version, "N/A", sizeof(drvinfo->fw_version));
+       strlcpy(drvinfo->bus_info, pci_name(priv->pdev),
                sizeof(drvinfo->bus_info));
 
        drvinfo->n_stats = ((priv->stats_flag) ? ARRAY_SIZE(bdx_stat_names) : 0);
index d9625f62b026cd06bbfdff222af8950b90bd3027..70d1920cac9799b279564cd59a336d9210688d77 100644 (file)
@@ -904,10 +904,9 @@ static int cpmac_set_ringparam(struct net_device *dev,
 static void cpmac_get_drvinfo(struct net_device *dev,
                              struct ethtool_drvinfo *info)
 {
-       strcpy(info->driver, "cpmac");
-       strcpy(info->version, CPMAC_VERSION);
-       info->fw_version[0] = '\0';
-       sprintf(info->bus_info, "%s", "cpmac");
+       strlcpy(info->driver, "cpmac", sizeof(info->driver));
+       strlcpy(info->version, CPMAC_VERSION, sizeof(info->version));
+       snprintf(info->bus_info, sizeof(info->bus_info), "%s", "cpmac");
        info->regdump_len = 0;
 }
 
index 40aff684aa23af64fc3ff03f0c5a54df798c0484..bea736b8c3ecb602f3c0059eecec2bd58382870e 100644 (file)
@@ -944,9 +944,10 @@ static void cpsw_get_drvinfo(struct net_device *ndev,
                             struct ethtool_drvinfo *info)
 {
        struct cpsw_priv *priv = netdev_priv(ndev);
-       strcpy(info->driver, "TI CPSW Driver v1.0");
-       strcpy(info->version, "1.0");
-       strcpy(info->bus_info, priv->pdev->name);
+
+       strlcpy(info->driver, "TI CPSW Driver v1.0", sizeof(info->driver));
+       strlcpy(info->version, "1.0", sizeof(info->version));
+       strlcpy(info->bus_info, priv->pdev->name, sizeof(info->bus_info));
 }
 
 static u32 cpsw_get_msglevel(struct net_device *ndev)
index 6841a22c8621c29196781cb2baba1984bd56b304..6621ae3a98d9007b211a90c599357a6a3ddaf70a 100644 (file)
@@ -480,8 +480,8 @@ static void emac_dump_regs(struct emac_priv *priv)
 static void emac_get_drvinfo(struct net_device *ndev,
                             struct ethtool_drvinfo *info)
 {
-       strcpy(info->driver, emac_version_string);
-       strcpy(info->version, EMAC_MODULE_VERSION);
+       strlcpy(info->driver, emac_version_string, sizeof(info->driver));
+       strlcpy(info->version, EMAC_MODULE_VERSION, sizeof(info->version));
 }
 
 /**
index e321d0b6fc882a4969a1a45ef2ce4b7a5de29864..445c0595c997e4e75316bcaca11fd7c1b3dbd9ce 100644 (file)
@@ -1226,8 +1226,8 @@ int gelic_net_open(struct net_device *netdev)
 void gelic_net_get_drvinfo(struct net_device *netdev,
                           struct ethtool_drvinfo *info)
 {
-       strncpy(info->driver, DRV_NAME, sizeof(info->driver) - 1);
-       strncpy(info->version, DRV_VERSION, sizeof(info->version) - 1);
+       strlcpy(info->driver, DRV_NAME, sizeof(info->driver));
+       strlcpy(info->version, DRV_VERSION, sizeof(info->version));
 }
 
 static int gelic_ether_get_settings(struct net_device *netdev,
index 9c288cd7d1718f4c444117313b2d6ac051266065..ffe519382e111a04dd37c904a6080cee561e2d47 100644 (file)
@@ -72,11 +72,13 @@ spider_net_ethtool_get_drvinfo(struct net_device *netdev,
        card = netdev_priv(netdev);
 
        /* clear and fill out info */
-       memset(drvinfo, 0, sizeof(struct ethtool_drvinfo));
-       strncpy(drvinfo->driver, spider_net_driver_name, 32);
-       strncpy(drvinfo->version, VERSION, 32);
-       strcpy(drvinfo->fw_version, "no information");
-       strncpy(drvinfo->bus_info, pci_name(card->pdev), 32);
+       strlcpy(drvinfo->driver, spider_net_driver_name,
+               sizeof(drvinfo->driver));
+       strlcpy(drvinfo->version, VERSION, sizeof(drvinfo->version));
+       strlcpy(drvinfo->fw_version, "no information",
+               sizeof(drvinfo->fw_version));
+       strlcpy(drvinfo->bus_info, pci_name(card->pdev),
+               sizeof(drvinfo->bus_info));
 }
 
 static void
index 9819349eaa1e88a1a3cfe2ffd3958b9665ee5b20..23a789e86de4174ff53e50523e29c1c1cf682975 100644 (file)
@@ -1976,9 +1976,10 @@ tc35815_set_multicast_list(struct net_device *dev)
 static void tc35815_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info)
 {
        struct tc35815_local *lp = netdev_priv(dev);
-       strcpy(info->driver, MODNAME);
-       strcpy(info->version, DRV_VERSION);
-       strcpy(info->bus_info, pci_name(lp->pci_dev));
+
+       strlcpy(info->driver, MODNAME, sizeof(info->driver));
+       strlcpy(info->version, DRV_VERSION, sizeof(info->version));
+       strlcpy(info->bus_info, pci_name(lp->pci_dev), sizeof(info->bus_info));
 }
 
 static int tc35815_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
index d9f69b82cc4ff638981798e23bbe3c0e9e6329f1..d3b3571b60134bb0f2724bb37af47e867e2d8e95 100644 (file)
@@ -1124,9 +1124,8 @@ static int axienet_ethtools_set_settings(struct net_device *ndev,
 static void axienet_ethtools_get_drvinfo(struct net_device *ndev,
                                         struct ethtool_drvinfo *ed)
 {
-       memset(ed, 0, sizeof(struct ethtool_drvinfo));
-       strcpy(ed->driver, DRIVER_NAME);
-       strcpy(ed->version, DRIVER_VERSION);
+       strlcpy(ed->driver, DRIVER_NAME, sizeof(ed->driver));
+       strlcpy(ed->version, DRIVER_VERSION, sizeof(ed->version));
        ed->regdump_len = sizeof(u32) * AXIENET_REGS_N;
 }
 
index 94a1f94f74b89f7a4d9a05c47ea0a44672c1adc8..98e09d0d3ce22e153603efc37f486dfdf55174ac 100644 (file)
@@ -1412,7 +1412,8 @@ static void netdev_get_drvinfo(struct net_device *dev,
                               struct ethtool_drvinfo *info)
 {
        strlcpy(info->driver, "xirc2ps_cs", sizeof(info->driver));
-       sprintf(info->bus_info, "PCMCIA 0x%lx", dev->base_addr);
+       snprintf(info->bus_info, sizeof(info->bus_info), "PCMCIA 0x%lx",
+                dev->base_addr);
 }
 
 static const struct ethtool_ops netdev_ethtool_ops = {
index d3ebb73277bed4306363aaa20b9ea699d49bcc20..a4be1ad886c50981f7ae1ab24d0e6aa7f7b1c414 100644 (file)
@@ -977,11 +977,12 @@ static void ixp4xx_get_drvinfo(struct net_device *dev,
                               struct ethtool_drvinfo *info)
 {
        struct port *port = netdev_priv(dev);
-       strcpy(info->driver, DRV_NAME);
+
+       strlcpy(info->driver, DRV_NAME, sizeof(info->driver));
        snprintf(info->fw_version, sizeof(info->fw_version), "%u:%u:%u:%u",
                 port->firmware[0], port->firmware[1],
                 port->firmware[2], port->firmware[3]);
-       strcpy(info->bus_info, "internal");
+       strlcpy(info->bus_info, "internal", sizeof(info->bus_info));
 }
 
 static int ixp4xx_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
index f825a629a699cfe5fac73803353da4b47ca18974..a9975c7e64617a7bc78957b074ff004e4446c273 100644 (file)
@@ -304,9 +304,9 @@ int netvsc_recv_callback(struct hv_device *device_obj,
 static void netvsc_get_drvinfo(struct net_device *net,
                               struct ethtool_drvinfo *info)
 {
-       strcpy(info->driver, KBUILD_MODNAME);
-       strcpy(info->version, HV_DRV_VERSION);
-       strcpy(info->fw_version, "N/A");
+       strlcpy(info->driver, KBUILD_MODNAME, sizeof(info->driver));
+       strlcpy(info->version, HV_DRV_VERSION, sizeof(info->version));
+       strlcpy(info->fw_version, "N/A", sizeof(info->fw_version));
 }
 
 static int netvsc_change_mtu(struct net_device *ndev, int mtu)
index 0ae45182f40dc1427592ec8ca9f81ef027b3d080..1047e587580136ff538d4f93b0c1a2b69148b79e 100644 (file)
@@ -585,8 +585,8 @@ static int macvlan_fdb_del(struct ndmsg *ndm,
 static void macvlan_ethtool_get_drvinfo(struct net_device *dev,
                                        struct ethtool_drvinfo *drvinfo)
 {
-       snprintf(drvinfo->driver, 32, "macvlan");
-       snprintf(drvinfo->version, 32, "0.1");
+       strlcpy(drvinfo->driver, "macvlan", sizeof(drvinfo->driver));
+       strlcpy(drvinfo->version, "0.1", sizeof(drvinfo->version));
 }
 
 static int macvlan_ethtool_get_settings(struct net_device *dev,
index d8b9b1e8ee0221479e35dd143f36cc7eb4030913..f433b594388e170b28b1aa57a92485625d897cb6 100644 (file)
@@ -410,10 +410,10 @@ static void rionet_get_drvinfo(struct net_device *ndev,
 {
        struct rionet_private *rnet = netdev_priv(ndev);
 
-       strcpy(info->driver, DRV_NAME);
-       strcpy(info->version, DRV_VERSION);
-       strcpy(info->fw_version, "n/a");
-       strcpy(info->bus_info, rnet->mport->name);
+       strlcpy(info->driver, DRV_NAME, sizeof(info->driver));
+       strlcpy(info->version, DRV_VERSION, sizeof(info->version));
+       strlcpy(info->fw_version, "n/a", sizeof(info->fw_version));
+       strlcpy(info->bus_info, rnet->mport->name, sizeof(info->bus_info));
 }
 
 static u32 rionet_get_msglevel(struct net_device *ndev)
index 50d167330d384e76b8d3ebfe9cd15cd26dd45c87..19bc23f20526d3f04771e8764cdf1a71264d5ad9 100644 (file)
@@ -510,8 +510,8 @@ void asix_get_drvinfo(struct net_device *net, struct ethtool_drvinfo *info)
 {
        /* Inherit standard device info */
        usbnet_get_drvinfo(net, info);
-       strncpy (info->driver, DRIVER_NAME, sizeof info->driver);
-       strncpy (info->version, DRIVER_VERSION, sizeof info->version);
+       strlcpy(info->driver, DRIVER_NAME, sizeof(info->driver));
+       strlcpy(info->version, DRIVER_VERSION, sizeof(info->version));
        info->eedump_len = AX_EEPROM_LEN;
 }
 
index 18d9579123ea82a2b649e0f2bdcdaa6a9f2ca80c..8d5cac2d8e33bee6b2545d45e83d24f52f8ac4c3 100644 (file)
@@ -685,9 +685,9 @@ static void catc_get_drvinfo(struct net_device *dev,
                             struct ethtool_drvinfo *info)
 {
        struct catc *catc = netdev_priv(dev);
-       strncpy(info->driver, driver_name, ETHTOOL_BUSINFO_LEN);
-       strncpy(info->version, DRIVER_VERSION, ETHTOOL_BUSINFO_LEN);
-       usb_make_path (catc->usbdev, info->bus_info, sizeof info->bus_info);
+       strlcpy(info->driver, driver_name, sizeof(info->driver));
+       strlcpy(info->version, DRIVER_VERSION, sizeof(info->version));
+       usb_make_path(catc->usbdev, info->bus_info, sizeof(info->bus_info));
 }
 
 static int catc_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
index 71b6e92b8e9b687c70d0eda9416f1e235a788747..016aa6fe6acbba679c6544fd40f133aed0af1cf3 100644 (file)
@@ -65,9 +65,9 @@ cdc_ncm_get_drvinfo(struct net_device *net, struct ethtool_drvinfo *info)
 {
        struct usbnet *dev = netdev_priv(net);
 
-       strncpy(info->driver, dev->driver_name, sizeof(info->driver));
-       strncpy(info->version, DRIVER_VERSION, sizeof(info->version));
-       strncpy(info->fw_version, dev->driver_info->description,
+       strlcpy(info->driver, dev->driver_name, sizeof(info->driver));
+       strlcpy(info->version, DRIVER_VERSION, sizeof(info->version));
+       strlcpy(info->fw_version, dev->driver_info->description,
                sizeof(info->fw_version));
        usb_make_path(dev->udev, info->bus_info, sizeof(info->bus_info));
 }
index a0b5807b30d4210816b7fe446ad241fe18da7ee8..3c02f950a3d2018b50a90b32991a32e018c1e0eb 100644 (file)
@@ -1074,8 +1074,9 @@ static void pegasus_get_drvinfo(struct net_device *dev,
                                struct ethtool_drvinfo *info)
 {
        pegasus_t *pegasus = netdev_priv(dev);
-       strncpy(info->driver, driver_name, sizeof(info->driver) - 1);
-       strncpy(info->version, DRIVER_VERSION, sizeof(info->version) - 1);
+
+       strlcpy(info->driver, driver_name, sizeof(info->driver));
+       strlcpy(info->version, DRIVER_VERSION, sizeof(info->version));
        usb_make_path(pegasus->usb, info->bus_info, sizeof(info->bus_info));
 }
 
index 5f39a3b225ef8729f47707dbfa2e8dcc98b52b54..a491d3a95393e4c533918c572ab7ba9256fa48ec 100644 (file)
@@ -776,9 +776,9 @@ static void rtl8150_get_drvinfo(struct net_device *netdev, struct ethtool_drvinf
 {
        rtl8150_t *dev = netdev_priv(netdev);
 
-       strncpy(info->driver, driver_name, ETHTOOL_BUSINFO_LEN);
-       strncpy(info->version, DRIVER_VERSION, ETHTOOL_BUSINFO_LEN);
-       usb_make_path(dev->udev, info->bus_info, sizeof info->bus_info);
+       strlcpy(info->driver, driver_name, sizeof(info->driver));
+       strlcpy(info->version, DRIVER_VERSION, sizeof(info->version));
+       usb_make_path(dev->udev, info->bus_info, sizeof(info->bus_info));
 }
 
 static int rtl8150_get_settings(struct net_device *netdev, struct ethtool_cmd *ecmd)
index 18dd4257ab17eaba7115ab33fe3bef2743f38a63..453aa6c1277c5347c2f5fa7864ba1c43f483a5a6 100644 (file)
@@ -598,8 +598,8 @@ static void sierra_net_get_drvinfo(struct net_device *net,
 {
        /* Inherit standard device info */
        usbnet_get_drvinfo(net, info);
-       strncpy(info->driver, driver_name, sizeof info->driver);
-       strncpy(info->version, DRIVER_VERSION, sizeof info->version);
+       strlcpy(info->driver, driver_name, sizeof(info->driver));
+       strlcpy(info->version, DRIVER_VERSION, sizeof(info->version));
 }
 
 static u32 sierra_net_get_link(struct net_device *net)
index 587a218b2345ed06eb938f5d01ed832c48dd7459..8c9fa4b41d78616bd0efe46a45f3b3eeb30a5167 100644 (file)
@@ -207,7 +207,7 @@ vmxnet3_get_drvinfo(struct net_device *netdev, struct ethtool_drvinfo *drvinfo)
                sizeof(drvinfo->version));
 
        strlcpy(drvinfo->bus_info, pci_name(adapter->pdev),
-               ETHTOOL_BUSINFO_LEN);
+               sizeof(drvinfo->bus_info));
        drvinfo->n_stats = vmxnet3_get_sset_count(netdev, ETH_SS_STATS);
        drvinfo->testinfo_len = 0;
        drvinfo->eedump_len   = 0;
index 1d76ae855f077dd5d3dbb7230d392ecc7c0b3c68..cedd4d30d996dd431341bd4c2a1e947f801f2f16 100644 (file)
@@ -596,12 +596,12 @@ static void i2400m_get_drvinfo(struct net_device *net_dev,
 {
        struct i2400m *i2400m = net_dev_to_i2400m(net_dev);
 
-       strncpy(info->driver, KBUILD_MODNAME, sizeof(info->driver) - 1);
-       strncpy(info->fw_version,
-               i2400m->fw_name ? : "", sizeof(info->fw_version) - 1);
+       strlcpy(info->driver, KBUILD_MODNAME, sizeof(info->driver));
+       strlcpy(info->fw_version, i2400m->fw_name ? : "",
+               sizeof(info->fw_version));
        if (net_dev->dev.parent)
-               strncpy(info->bus_info, dev_name(net_dev->dev.parent),
-                       sizeof(info->bus_info) - 1);
+               strlcpy(info->bus_info, dev_name(net_dev->dev.parent),
+                       sizeof(info->bus_info));
 }
 
 static const struct ethtool_ops i2400m_ethtool_ops = {
index 080f36303a4f1887819b5ce7df994f1a916b8bc3..cd15a93d9084377ce4a8ce79d68c9b49b7fb9845 100644 (file)
@@ -346,9 +346,9 @@ static void i2400mu_get_drvinfo(struct net_device *net_dev,
        struct i2400mu *i2400mu = container_of(i2400m, struct i2400mu, i2400m);
        struct usb_device *udev = i2400mu->usb_dev;
 
-       strncpy(info->driver, KBUILD_MODNAME, sizeof(info->driver) - 1);
-       strncpy(info->fw_version,
-               i2400m->fw_name ? : "", sizeof(info->fw_version) - 1);
+       strlcpy(info->driver, KBUILD_MODNAME, sizeof(info->driver));
+       strlcpy(info->fw_version, i2400m->fw_name ? : "",
+               sizeof(info->fw_version));
        usb_make_path(udev, info->bus_info, sizeof(info->bus_info));
 }
 
index 74a616b4de8e027c5f877f2910a526fed9d29aa3..8c28a1518409991864310f5d5f0121b955c57042 100644 (file)
@@ -395,9 +395,11 @@ static void brcmf_ethtool_get_drvinfo(struct net_device *ndev,
        struct brcmf_if *ifp = netdev_priv(ndev);
        struct brcmf_pub *drvr = ifp->drvr;
 
-       sprintf(info->driver, KBUILD_MODNAME);
-       sprintf(info->version, "%lu", drvr->drv_version);
-       sprintf(info->bus_info, "%s", dev_name(drvr->bus_if->dev));
+       strlcpy(info->driver, KBUILD_MODNAME, sizeof(info->driver));
+       snprintf(info->version, sizeof(info->version), "%lu",
+                drvr->drv_version);
+       strlcpy(info->bus_info, dev_name(drvr->bus_if->dev),
+               sizeof(info->bus_info));
 }
 
 static const struct ethtool_ops brcmf_ethtool_ops = {
index 638a57f4d8a11cc1ad040914f7991f2a780fefd9..029a7acf7b7a9c5a010f7a2f728177ce53d9ad5c 100644 (file)
@@ -5444,17 +5444,14 @@ void qeth_core_get_drvinfo(struct net_device *dev,
                struct ethtool_drvinfo *info)
 {
        struct qeth_card *card = dev->ml_priv;
-       if (card->options.layer2)
-               strcpy(info->driver, "qeth_l2");
-       else
-               strcpy(info->driver, "qeth_l3");
-
-       strcpy(info->version, "1.0");
-       strcpy(info->fw_version, card->info.mcl_level);
-       sprintf(info->bus_info, "%s/%s/%s",
-                       CARD_RDEV_ID(card),
-                       CARD_WDEV_ID(card),
-                       CARD_DDEV_ID(card));
+
+       strlcpy(info->driver, card->options.layer2 ? "qeth_l2" : "qeth_l3",
+               sizeof(info->driver));
+       strlcpy(info->version, "1.0", sizeof(info->version));
+       strlcpy(info->fw_version, card->info.mcl_level,
+               sizeof(info->fw_version));
+       snprintf(info->bus_info, sizeof(info->bus_info), "%s/%s/%s",
+                CARD_RDEV_ID(card), CARD_WDEV_ID(card), CARD_DDEV_ID(card));
 }
 EXPORT_SYMBOL_GPL(qeth_core_get_drvinfo);
 
index a3b91c7ee8ff896102418c4c82b756574df2922a..4e470d4bb4e8f297c15ab40825f66e0ab7c9c239 100644 (file)
@@ -145,8 +145,8 @@ static void bcm_get_drvinfo(struct net_device *dev,
        struct bcm_interface_adapter *psIntfAdapter = Adapter->pvInterfaceAdapter;
        struct usb_device *udev = interface_to_usbdev(psIntfAdapter->interface);
 
-       strcpy(info->driver, DRV_NAME);
-       strcpy(info->version, DRV_VERSION);
+       strlcpy(info->driver, DRV_NAME, sizeof(info->driver));
+       strlcpy(info->version, DRV_VERSION, sizeof(info->version));
        snprintf(info->fw_version, sizeof(info->fw_version), "%u.%u",
                 Adapter->uiFlashLayoutMajorVersion,
                 Adapter->uiFlashLayoutMinorVersion);
index d0dabcf015a9b50bc453547477dbf9bd2ab6c3d2..fed78865adc6b3b5e7e025dd95fc49eaa5defe84 100644 (file)
@@ -157,12 +157,12 @@ static int ueth_change_mtu(struct net_device *net, int new_mtu)
 
 static void eth_get_drvinfo(struct net_device *net, struct ethtool_drvinfo *p)
 {
-       struct eth_dev  *dev = netdev_priv(net);
+       struct eth_dev *dev = netdev_priv(net);
 
-       strlcpy(p->driver, "g_ether", sizeof p->driver);
-       strlcpy(p->version, UETH__VERSION, sizeof p->version);
-       strlcpy(p->fw_version, dev->gadget->name, sizeof p->fw_version);
-       strlcpy(p->bus_info, dev_name(&dev->gadget->dev), sizeof p->bus_info);
+       strlcpy(p->driver, "g_ether", sizeof(p->driver));
+       strlcpy(p->version, UETH__VERSION, sizeof(p->version));
+       strlcpy(p->fw_version, dev->gadget->name, sizeof(p->fw_version));
+       strlcpy(p->bus_info, dev_name(&dev->gadget->dev), sizeof(p->bus_info));
 }
 
 /* REVISIT can also support:
index 84bbcd48e26489753ed30581980c93864fb3ace3..f15059ca37814806b6072469aad4340d3ebcfd42 100644 (file)
@@ -3560,15 +3560,15 @@ static void et131x_get_regs(struct net_device *netdev,
        regs_buff[num++] = readl(&aregs->rxdma.fbr1_min_des);
 }
 
-#define ET131X_DRVINFO_LEN 32 /* value from ethtool.h */
 static void et131x_get_drvinfo(struct net_device *netdev,
                               struct ethtool_drvinfo *info)
 {
        struct et131x_adapter *adapter = netdev_priv(netdev);
 
-       strncpy(info->driver, DRIVER_NAME, ET131X_DRVINFO_LEN);
-       strncpy(info->version, DRIVER_VERSION, ET131X_DRVINFO_LEN);
-       strncpy(info->bus_info, pci_name(adapter->pdev), ET131X_DRVINFO_LEN);
+       strlcpy(info->driver, DRIVER_NAME, sizeof(info->driver));
+       strlcpy(info->version, DRIVER_VERSION, sizeof(info->version));
+       strlcpy(info->bus_info, pci_name(adapter->pdev),
+               sizeof(info->bus_info));
 }
 
 static struct ethtool_ops et131x_ethtool_ops = {
index 86a680c09ba2a7e2bf62276d1f85e3415c0827c6..67ca5c990437f09c4cabe617145ec4ea0e3a0db5 100644 (file)
@@ -2077,11 +2077,12 @@ static void ft1000_get_drvinfo(struct net_device *dev,
        struct ft1000_info *ft_info;
        ft_info = netdev_priv(dev);
 
-       snprintf(info->driver, 32, "ft1000");
-       snprintf(info->bus_info, ETHTOOL_BUSINFO_LEN, "PCMCIA 0x%lx",
+       strlcpy(info->driver, "ft1000", sizeof(info->driver));
+       snprintf(info->bus_info, sizeof(info->bus_info), "PCMCIA 0x%lx",
                 dev->base_addr);
-       snprintf(info->fw_version, 32, "%d.%d.%d.%d", ft_info->DspVer[0],
-                ft_info->DspVer[1], ft_info->DspVer[2], ft_info->DspVer[3]);
+       snprintf(info->fw_version, sizeof(info->fw_version), "%d.%d.%d.%d",
+                ft_info->DspVer[0], ft_info->DspVer[1], ft_info->DspVer[2],
+                ft_info->DspVer[3]);
 }
 
 static u32 ft1000_get_link(struct net_device *dev)
index f15b31b37ca50920a6e4a314eea40f9e8d3185d5..83b103091cf2e59e39c28ef6780e53ee6d35f86a 100644 (file)
@@ -46,9 +46,9 @@
 static void cvm_oct_get_drvinfo(struct net_device *dev,
                                struct ethtool_drvinfo *info)
 {
-       strcpy(info->driver, "cavium-ethernet");
-       strcpy(info->version, OCTEON_ETHERNET_VERSION);
-       strcpy(info->bus_info, "Builtin");
+       strlcpy(info->driver, "cavium-ethernet", sizeof(info->driver));
+       strlcpy(info->version, OCTEON_ETHERNET_VERSION, sizeof(info->version));
+       strlcpy(info->bus_info, "Builtin", sizeof(info->bus_info));
 }
 
 static int cvm_oct_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
index 36452fb7cef8e0a6000f4d91b96306dcb323636e..0cfb3ecaadee53a724d886ce0c56d5bd7f431875 100644 (file)
@@ -34,9 +34,9 @@ static void rtl819x_ethtool_get_drvinfo(struct net_device *dev,
 {
        struct r8192_priv *priv = rtllib_priv(dev);
 
-       strcpy(info->driver, DRV_NAME);
-       strcpy(info->version, DRV_VERSION);
-       strcpy(info->bus_info, pci_name(priv->pdev));
+       strlcpy(info->driver, DRV_NAME, sizeof(info->driver));
+       strlcpy(info->version, DRV_VERSION, sizeof(info->version));
+       strlcpy(info->bus_info, pci_name(priv->pdev), sizeof(info->bus_info));
 }
 
 static u32 rtl819x_ethtool_get_link(struct net_device *dev)
index fb421407e10659318fe8f1f5d77e03a1be96404a..235cc2a7ffe68d15603c716e6fce78934df05f97 100644 (file)
@@ -457,17 +457,17 @@ int wl_close( struct net_device *dev )
 
 static void wl_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info)
 {
-    strncpy(info->driver, DRIVER_NAME, sizeof(info->driver) - 1);
-    strncpy(info->version, DRV_VERSION_STR, sizeof(info->version) - 1);
-//     strncpy(info.fw_version, priv->fw_name,
-//     sizeof(info.fw_version) - 1);
+    strlcpy(info->driver, DRIVER_NAME, sizeof(info->driver));
+    strlcpy(info->version, DRV_VERSION_STR, sizeof(info->version));
+//     strlcpy(info.fw_version, priv->fw_name,
+//     sizeof(info.fw_version));
 
     if (dev->dev.parent) {
        dev_set_name(dev->dev.parent, "%s", info->bus_info);
-       //strncpy(info->bus_info, dev->dev.parent->bus_id,
-       //      sizeof(info->bus_info) - 1);
+       //strlcpy(info->bus_info, dev->dev.parent->bus_id,
+       //      sizeof(info->bus_info));
     } else {
-       snprintf(info->bus_info, sizeof(info->bus_info) - 1,
+       snprintf(info->bus_info, sizeof(info->bus_info),
                "PCMCIA FIXME");
 //                 "PCMCIA 0x%lx", priv->hw.iobase);
     }
index 4ec3c0d7a18b84bb895262de69bf080886391025..a0aa721d8b216bb29350be51270a9e4c6330eaed 100644 (file)
@@ -159,12 +159,12 @@ static int ueth_change_mtu(struct net_device *net, int new_mtu)
 
 static void eth_get_drvinfo(struct net_device *net, struct ethtool_drvinfo *p)
 {
-       struct eth_dev  *dev = netdev_priv(net);
+       struct eth_dev *dev = netdev_priv(net);
 
-       strlcpy(p->driver, "g_ether", sizeof p->driver);
-       strlcpy(p->version, UETH__VERSION, sizeof p->version);
-       strlcpy(p->fw_version, dev->gadget->name, sizeof p->fw_version);
-       strlcpy(p->bus_info, dev_name(&dev->gadget->dev), sizeof p->bus_info);
+       strlcpy(p->driver, "g_ether", sizeof(p->driver));
+       strlcpy(p->version, UETH__VERSION, sizeof(p->version));
+       strlcpy(p->fw_version, dev->gadget->name, sizeof(p->fw_version));
+       strlcpy(p->bus_info, dev_name(&dev->gadget->dev), sizeof(p->bus_info));
 }
 
 /* REVISIT can also support:
index 4a6d31a082b9e534eadc3fa2873313fa07cc7869..09f9108d4688b11ace1137530c047319b62bee49 100644 (file)
@@ -640,9 +640,9 @@ static int vlan_ethtool_get_settings(struct net_device *dev,
 static void vlan_ethtool_get_drvinfo(struct net_device *dev,
                                     struct ethtool_drvinfo *info)
 {
-       strcpy(info->driver, vlan_fullname);
-       strcpy(info->version, vlan_version);
-       strcpy(info->fw_version, "N/A");
+       strlcpy(info->driver, vlan_fullname, sizeof(info->driver));
+       strlcpy(info->version, vlan_version, sizeof(info->version));
+       strlcpy(info->fw_version, "N/A", sizeof(info->fw_version));
 }
 
 static struct rtnl_link_stats64 *vlan_dev_get_stats64(struct net_device *dev, struct rtnl_link_stats64 *stats)
index fa388b2c60d780ec85102c47f8f14b922c620b60..90f4049a90ddf0aabd8cdd77764703be46d70c6d 100644 (file)
@@ -580,10 +580,10 @@ static int batadv_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
 static void batadv_get_drvinfo(struct net_device *dev,
                               struct ethtool_drvinfo *info)
 {
-       strcpy(info->driver, "B.A.T.M.A.N. advanced");
-       strcpy(info->version, BATADV_SOURCE_VERSION);
-       strcpy(info->fw_version, "N/A");
-       strcpy(info->bus_info, "batman");
+       strlcpy(info->driver, "B.A.T.M.A.N. advanced", sizeof(info->driver));
+       strlcpy(info->version, BATADV_SOURCE_VERSION, sizeof(info->version));
+       strlcpy(info->fw_version, "N/A", sizeof(info->fw_version));
+       strlcpy(info->bus_info, "batman", sizeof(info->bus_info));
 }
 
 static u32 batadv_get_msglevel(struct net_device *dev)
index 38974f70ec7bf3e7e7d4c65c06a25b8b4a33f0ca..e1bc090bc00acb160ead451894cf045b59ba386e 100644 (file)
@@ -184,10 +184,10 @@ static int br_set_mac_address(struct net_device *dev, void *p)
 
 static void br_getinfo(struct net_device *dev, struct ethtool_drvinfo *info)
 {
-       strcpy(info->driver, "bridge");
-       strcpy(info->version, BR_VERSION);
-       strcpy(info->fw_version, "N/A");
-       strcpy(info->bus_info, "N/A");
+       strlcpy(info->driver, "bridge", sizeof(info->driver));
+       strlcpy(info->version, BR_VERSION, sizeof(info->version));
+       strlcpy(info->fw_version, "N/A", sizeof(info->fw_version));
+       strlcpy(info->bus_info, "N/A", sizeof(info->bus_info));
 }
 
 static netdev_features_t br_fix_features(struct net_device *dev,
index e32083d5d8f8370d363b58b8c461cac53ce983ed..f795b0ca7ee66c8a3ee6a11a4ad4803299eefe41 100644 (file)
@@ -203,10 +203,10 @@ dsa_slave_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
 static void dsa_slave_get_drvinfo(struct net_device *dev,
                                  struct ethtool_drvinfo *drvinfo)
 {
-       strncpy(drvinfo->driver, "dsa", 32);
-       strncpy(drvinfo->version, dsa_driver_version, 32);
-       strncpy(drvinfo->fw_version, "N/A", 32);
-       strncpy(drvinfo->bus_info, "platform", 32);
+       strlcpy(drvinfo->driver, "dsa", sizeof(drvinfo->driver));
+       strlcpy(drvinfo->version, dsa_driver_version, sizeof(drvinfo->version));
+       strlcpy(drvinfo->fw_version, "N/A", sizeof(drvinfo->fw_version));
+       strlcpy(drvinfo->bus_info, "platform", sizeof(drvinfo->bus_info));
 }
 
 static int dsa_slave_nway_reset(struct net_device *dev)
index 44cd5c3a4c220d9ae8a1c8c52552956f22b26668..0531de6c7a4a858e6c5ef88c53e9dd639aff6fef 100644 (file)
@@ -97,7 +97,7 @@ static int internal_dev_stop(struct net_device *netdev)
 static void internal_dev_getinfo(struct net_device *netdev,
                                 struct ethtool_drvinfo *info)
 {
-       strcpy(info->driver, "openvswitch");
+       strlcpy(info->driver, "openvswitch", sizeof(info->driver));
 }
 
 static const struct ethtool_ops internal_dev_ethtool_ops = {
index 48c48ffafa1db51d9b96ea2d5a418e592dbcf436..e37862f1b1270d8e2056fb6289f01bf69b583720 100644 (file)
@@ -15,10 +15,10 @@ static void cfg80211_get_drvinfo(struct net_device *dev,
        strlcpy(info->version, init_utsname()->release, sizeof(info->version));
 
        if (wdev->wiphy->fw_version[0])
-               strncpy(info->fw_version, wdev->wiphy->fw_version,
+               strlcpy(info->fw_version, wdev->wiphy->fw_version,
                        sizeof(info->fw_version));
        else
-               strncpy(info->fw_version, "N/A", sizeof(info->fw_version));
+               strlcpy(info->fw_version, "N/A", sizeof(info->fw_version));
 
        strlcpy(info->bus_info, dev_name(wiphy_dev(wdev->wiphy)),
                sizeof(info->bus_info));