ethtool: fix drvinfo strings set in drivers
Subsystems (43)
PATCH v2 1/1 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 <[email protected]>
---
v1->v2:
- added couple more drivers (hopefully all which have similar issues)
arch/um/drivers/net_kern.c | 4 ++-- drivers/infiniband/hw/nes/nes_nic.c | 12 +++++++----- drivers/infiniband/ulp/ipoib/ipoib_ethtool.c | 2 +- drivers/net/bonding/bond_main.c | 9 +++++---- drivers/net/cris/eth_v10.c | 8 ++++---- drivers/net/ethernet/3com/3c501.c | 7 ++++--- drivers/net/ethernet/3com/3c509.c | 4 ++-- drivers/net/ethernet/3com/3c515.c | 7 ++++--- drivers/net/ethernet/8390/3c503.c | 7 ++++--- drivers/net/ethernet/8390/ax88796.c | 6 +++--- drivers/net/ethernet/adi/bfin_mac.c | 8 ++++---- drivers/net/ethernet/aeroflex/greth.c | 9 +++++---- drivers/net/ethernet/amd/au1000_eth.c | 8 ++++---- drivers/net/ethernet/amd/sunlance.c | 4 ++-- drivers/net/ethernet/broadcom/bcm63xx_enet.c | 9 +++++---- drivers/net/ethernet/cirrus/ep93xx_eth.c | 4 ++-- drivers/net/ethernet/davicom/dm9000.c | 7 ++++--- drivers/net/ethernet/dec/ewrk3.c | 8 ++++---- drivers/net/ethernet/dlink/dl2k.c | 7 ++++--- drivers/net/ethernet/emulex/benet/be_ethtool.c | 12 ++++++------ drivers/net/ethernet/faraday/ftgmac100.c | 6 +++--- drivers/net/ethernet/faraday/ftmac100.c | 6 +++--- drivers/net/ethernet/freescale/fec.c | 7 ++++--- drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c | 4 ++-- drivers/net/ethernet/freescale/gianfar.h | 2 -- drivers/net/ethernet/freescale/gianfar_ethtool.c | 9 +++++---- drivers/net/ethernet/freescale/ucc_geth_ethtool.c | 8 ++++---- drivers/net/ethernet/i825xx/3c505.c | 7 ++++--- drivers/net/ethernet/i825xx/3c507.c | 7 ++++--- drivers/net/ethernet/ibm/emac/core.c | 9 ++++----- drivers/net/ethernet/ibm/ibmveth.c | 5 ++--- drivers/net/ethernet/korina.c | 6 +++--- drivers/net/ethernet/lantiq_etop.c | 6 +++--- drivers/net/ethernet/marvell/pxa168_eth.c | 8 ++++---- drivers/net/ethernet/neterion/vxge/vxge-ethtool.c | 6 +++--- drivers/net/ethernet/nuvoton/w90p910_ether.c | 4 ++-- drivers/net/ethernet/nxp/lpc_eth.c | 7 ++++--- drivers/net/ethernet/octeon/octeon_mgmt.c | 8 ++++---- drivers/net/ethernet/packetengines/hamachi.c | 7 ++++--- drivers/net/ethernet/packetengines/yellowfin.c | 7 ++++--- drivers/net/ethernet/rdc/r6040.c | 6 +++--- drivers/net/ethernet/sgi/ioc3-eth.c | 6 +++--- drivers/net/ethernet/smsc/smc911x.c | 7 ++++--- drivers/net/ethernet/smsc/smc91x.c | 7 ++++--- drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c | 3 +-- drivers/net/ethernet/sun/sunbmac.c | 4 ++-- drivers/net/ethernet/sun/sunqe.c | 7 ++++--- drivers/net/ethernet/sun/sunvnet.c | 4 ++-- drivers/net/ethernet/tehuti/tehuti.c | 8 ++++---- drivers/net/ethernet/ti/cpmac.c | 7 +++---- drivers/net/ethernet/ti/cpsw.c | 7 ++++--- drivers/net/ethernet/ti/davinci_emac.c | 4 ++-- drivers/net/ethernet/toshiba/ps3_gelic_net.c | 4 ++-- drivers/net/ethernet/toshiba/spider_net_ethtool.c | 12 +++++++----- drivers/net/ethernet/toshiba/tc35815.c | 7 ++++--- drivers/net/ethernet/xilinx/xilinx_axienet_main.c | 5 ++--- drivers/net/ethernet/xircom/xirc2ps_cs.c | 3 ++- drivers/net/ethernet/xscale/ixp4xx_eth.c | 5 +++-- drivers/net/hyperv/netvsc_drv.c | 6 +++--- drivers/net/macvlan.c | 4 ++-- drivers/net/rionet.c | 8 ++++---- drivers/net/usb/asix_common.c | 4 ++-- drivers/net/usb/catc.c | 6 +++--- drivers/net/usb/cdc_ncm.c | 6 +++--- drivers/net/usb/pegasus.c | 5 +++-- drivers/net/usb/rtl8150.c | 6 +++--- drivers/net/usb/sierra_net.c | 4 ++-- drivers/net/vmxnet3/vmxnet3_ethtool.c | 2 +- drivers/net/wimax/i2400m/netdev.c | 10 +++++----- drivers/net/wimax/i2400m/usb.c | 6 +++--- drivers/net/wireless/brcm80211/brcmfmac/dhd_linux.c | 8 +++++--- drivers/s390/net/qeth_core_main.c | 19 ++++++++----------- drivers/staging/bcm/Bcmnet.c | 4 ++-- drivers/staging/ccg/u_ether.c | 10 +++++----- drivers/staging/et131x/et131x.c | 8 ++++---- drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c | 9 +++++---- drivers/staging/octeon/ethernet-mdio.c | 6 +++--- drivers/staging/rtl8192e/rtl8192e/rtl_ethtool.c | 6 +++--- drivers/staging/wlags49_h2/wl_netdev.c | 14 +++++++------- drivers/usb/gadget/u_ether.c | 10 +++++----- net/8021q/vlan_dev.c | 6 +++--- net/batman-adv/soft-interface.c | 8 ++++---- net/bridge/br_device.c | 8 ++++---- net/dsa/slave.c | 8 ++++---- net/openvswitch/vport-internal_dev.c | 2 +- net/wireless/ethtool.c | 4 ++-- 86 files changed, 297 insertions(+), 277 deletions(-)
arch/um/drivers/net_kern.c +2 -2
@@ -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 = {
drivers/infiniband/hw/nes/nes_nic.c +7 -5
@@ -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 ;
drivers/infiniband/ulp/ipoib/ipoib_ethtool.c +1 -1
@@ -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,
drivers/net/bonding/bond_main.c +5 -4
@@ -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 = {
drivers/net/cris/eth_v10.c +4 -4
@@ -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)
drivers/net/ethernet/3com/3c501.c +4 -3
@@ -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)
drivers/net/ethernet/3com/3c509.c +2 -2
@@ -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)
drivers/net/ethernet/3com/3c515.c +4 -3
@@ -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)
drivers/net/ethernet/8390/3c503.c +4 -3
@@ -695,9 +695,10 @@ el2_block_input(struct net_device *dev, int count, struct sk_buff *skb, int ringstatic 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 = {
drivers/net/ethernet/8390/ax88796.c +3 -3
@@ -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)
drivers/net/ethernet/adi/bfin_mac.c +4 -4
@@ -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,
drivers/net/ethernet/aeroflex/greth.c +5 -4
@@ -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 ); }
drivers/net/ethernet/amd/au1000_eth.c +4 -4
@@ -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 ; }
drivers/net/ethernet/amd/sunlance.c +2 -2
@@ -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 = {
drivers/net/ethernet/broadcom/bcm63xx_enet.c +5 -4
@@ -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 ; }
drivers/net/ethernet/cirrus/ep93xx_eth.c +2 -2
@@ -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)
drivers/net/ethernet/davicom/dm9000.c +4 -3
@@ -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)
drivers/net/ethernet/dec/ewrk3.c +4 -4
@@ -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 ; }
drivers/net/ethernet/dlink/dl2k.c +4 -3
@@ -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)
drivers/net/ethernet/emulex/benet/be_ethtool.c +6 -6
@@ -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));
drivers/net/ethernet/faraday/ftgmac100.c +3 -3
@@ -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,
drivers/net/ethernet/faraday/ftmac100.c +3 -3
@@ -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)
drivers/net/ethernet/freescale/fec.c +4 -3
@@ -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 = {
drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c +2 -2
@@ -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)
drivers/net/ethernet/freescale/gianfar.h +0 -2
@@ -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 ];
drivers/net/ethernet/freescale/gianfar_ethtool.c +5 -4
@@ -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 ; }
drivers/net/ethernet/freescale/ucc_geth_ethtool.c +4 -4
@@ -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); }
drivers/net/ethernet/i825xx/3c505.c +4 -3
@@ -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)
drivers/net/ethernet/i825xx/3c507.c +4 -3
@@ -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)
drivers/net/ethernet/ibm/emac/core.c +4 -5
@@ -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); }
drivers/net/ethernet/ibm/ibmveth.c +2 -3
@@ -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,
drivers/net/ethernet/korina.c +3 -3
@@ -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)
drivers/net/ethernet/lantiq_etop.c +3 -3
@@ -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
drivers/net/ethernet/marvell/pxa168_eth.c +4 -4
@@ -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 = {
drivers/net/ethernet/neterion/vxge/vxge-ethtool.c +3 -3
@@ -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;
drivers/net/ethernet/nuvoton/w90p910_ether.c +2 -2
@@ -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)
drivers/net/ethernet/nxp/lpc_eth.c +4 -3
@@ -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)
drivers/net/ethernet/octeon/octeon_mgmt.c +4 -4
@@ -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 ;
drivers/net/ethernet/packetengines/hamachi.c +4 -3
@@ -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)
drivers/net/ethernet/packetengines/yellowfin.c +4 -3
@@ -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 = {
drivers/net/ethernet/rdc/r6040.c +3 -3
@@ -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)
drivers/net/ethernet/sgi/ioc3-eth.c +3 -3
@@ -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)
drivers/net/ethernet/smsc/smc911x.c +4 -3
@@ -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)
drivers/net/ethernet/smsc/smc91x.c +4 -3
@@ -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)
drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c +1 -2
@@ -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,
drivers/net/ethernet/sun/sunbmac.c +2 -2
@@ -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)
drivers/net/ethernet/sun/sunqe.c +4 -3
@@ -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); }
drivers/net/ethernet/sun/sunvnet.c +2 -2
@@ -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)
drivers/net/ethernet/tehuti/tehuti.c +4 -4
@@ -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 );
drivers/net/ethernet/ti/cpmac.c +3 -4
@@ -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 ; }
drivers/net/ethernet/ti/cpsw.c +4 -3
@@ -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)
drivers/net/ethernet/ti/davinci_emac.c +2 -2
@@ -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)); }/**
drivers/net/ethernet/toshiba/ps3_gelic_net.c +2 -2
@@ -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,
drivers/net/ethernet/toshiba/spider_net_ethtool.c +7 -5
@@ -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
drivers/net/ethernet/toshiba/tc35815.c +4 -3
@@ -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)
drivers/net/ethernet/xilinx/xilinx_axienet_main.c +2 -3
@@ -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 ; }
drivers/net/ethernet/xircom/xirc2ps_cs.c +2 -1
@@ -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 = {
drivers/net/ethernet/xscale/ixp4xx_eth.c +3 -2
@@ -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)
drivers/net/hyperv/netvsc_drv.c +3 -3
@@ -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)
drivers/net/macvlan.c +2 -2
@@ -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,
drivers/net/rionet.c +4 -4
@@ -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)
drivers/net/usb/asix_common.c +2 -2
@@ -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 ; }
drivers/net/usb/catc.c +3 -3
@@ -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)
drivers/net/usb/cdc_ncm.c +3 -3
@@ -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)); }
drivers/net/usb/pegasus.c +3 -2
@@ -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)); }
drivers/net/usb/rtl8150.c +3 -3
@@ -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)
drivers/net/usb/sierra_net.c +2 -2
@@ -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)
drivers/net/vmxnet3/vmxnet3_ethtool.c +1 -1
@@ -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 ;
drivers/net/wimax/i2400m/netdev.c +5 -5
@@ -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 = {
drivers/net/wimax/i2400m/usb.c +3 -3
@@ -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)); }
drivers/net/wireless/brcm80211/brcmfmac/dhd_linux.c +5 -3
@@ -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 = {
drivers/s390/net/qeth_core_main.c +8 -11
@@ -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);
drivers/staging/bcm/Bcmnet.c +2 -2
@@ -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);
drivers/staging/ccg/u_ether.c +5 -5
@@ -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:
drivers/staging/et131x/et131x.c +4 -4
@@ -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 = {
drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c +5 -4
@@ -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)
drivers/staging/octeon/ethernet-mdio.c +3 -3
@@ -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)
drivers/staging/rtl8192e/rtl8192e/rtl_ethtool.c +3 -3
@@ -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)
drivers/staging/wlags49_h2/wl_netdev.c +7 -7
@@ -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); }
drivers/usb/gadget/u_ether.c +5 -5
@@ -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:
net/8021q/vlan_dev.c +3 -3
@@ -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)
net/batman-adv/soft-interface.c +4 -4
@@ -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)
net/bridge/br_device.c +4 -4
@@ -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,
net/dsa/slave.c +4 -4
@@ -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)
net/openvswitch/vport-internal_dev.c +1 -1
@@ -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 = {
net/wireless/ethtool.c +2 -2
@@ -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));
Signature · 1 line
1.8.1
From: Jiri Pirko <[email protected]>
Date: Sun, 6 Jan 2013 11:44:26 +0100
Quoted 8 lines
Use strlcpy where possible to ensure the string is \0 terminated. Use always sizeof(string) instead of 32,
ETHTOOL_BUSINFO_LENand custom defines.
Use snprintf instead of sprint.
Remove unnecessary inits of ->fw_version
Remove unnecessary inits of drvinfo struct.Signed-off-by Jiri Pirko <[email protected]>
Applied.