ethtool: fix drvinfo strings set in drivers

Use strlcpy where possible to ensure the string is \0 terminated.
Use always sizeof(string) instead of 32, ETHTOOL_BUSINFO_LEN
and custom defines.
Use snprintf instead of sprint.
Remove unnecessary inits of ->fw_version
Remove unnecessary inits of drvinfo struct.

Signed-off-by: Jiri Pirko <jiri@resnulli.us>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Jiri Pirko 2013-01-06 00:44:26 +00:00 коммит произвёл David S. Miller
Родитель 2afb9b5334
Коммит 7826d43f2d
86 изменённых файлов: 296 добавлений и 276 удалений

Просмотреть файл

@ -274,8 +274,8 @@ static void uml_net_poll_controller(struct net_device *dev)
static void uml_net_get_drvinfo(struct net_device *dev, static void uml_net_get_drvinfo(struct net_device *dev,
struct ethtool_drvinfo *info) struct ethtool_drvinfo *info)
{ {
strcpy(info->driver, DRIVER_NAME); strlcpy(info->driver, DRIVER_NAME, sizeof(info->driver));
strcpy(info->version, "42"); strlcpy(info->version, "42", sizeof(info->version));
} }
static const struct ethtool_ops uml_net_ethtool_ops = { static const struct ethtool_ops uml_net_ethtool_ops = {

Просмотреть файл

@ -1317,11 +1317,13 @@ static void nes_netdev_get_drvinfo(struct net_device *netdev,
struct nes_vnic *nesvnic = netdev_priv(netdev); struct nes_vnic *nesvnic = netdev_priv(netdev);
struct nes_adapter *nesadapter = nesvnic->nesdev->nesadapter; struct nes_adapter *nesadapter = nesvnic->nesdev->nesadapter;
strcpy(drvinfo->driver, DRV_NAME); strlcpy(drvinfo->driver, DRV_NAME, sizeof(drvinfo->driver));
strcpy(drvinfo->bus_info, pci_name(nesvnic->nesdev->pcidev)); strlcpy(drvinfo->bus_info, pci_name(nesvnic->nesdev->pcidev),
sprintf(drvinfo->fw_version, "%u.%u", nesadapter->firmware_version>>16, sizeof(drvinfo->bus_info));
nesadapter->firmware_version & 0x000000ff); snprintf(drvinfo->fw_version, sizeof(drvinfo->fw_version),
strcpy(drvinfo->version, DRV_VERSION); "%u.%u", nesadapter->firmware_version >> 16,
nesadapter->firmware_version & 0x000000ff);
strlcpy(drvinfo->version, DRV_VERSION, sizeof(drvinfo->version));
drvinfo->testinfo_len = 0; drvinfo->testinfo_len = 0;
drvinfo->eedump_len = 0; drvinfo->eedump_len = 0;
drvinfo->regdump_len = 0; drvinfo->regdump_len = 0;

Просмотреть файл

@ -39,7 +39,7 @@
static void ipoib_get_drvinfo(struct net_device *netdev, static void ipoib_get_drvinfo(struct net_device *netdev,
struct ethtool_drvinfo *drvinfo) 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, static int ipoib_get_coalesce(struct net_device *dev,

Просмотреть файл

@ -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, 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); strlcpy(drvinfo->driver, DRV_NAME, sizeof(drvinfo->driver));
strncpy(drvinfo->version, DRV_VERSION, 32); strlcpy(drvinfo->version, DRV_VERSION, sizeof(drvinfo->version));
snprintf(drvinfo->fw_version, 32, "%d", BOND_ABI_VERSION); snprintf(drvinfo->fw_version, sizeof(drvinfo->fw_version), "%d",
BOND_ABI_VERSION);
} }
static const struct ethtool_ops bond_ethtool_ops = { static const struct ethtool_ops bond_ethtool_ops = {

Просмотреть файл

@ -1448,10 +1448,10 @@ static int e100_set_settings(struct net_device *dev,
static void e100_get_drvinfo(struct net_device *dev, static void e100_get_drvinfo(struct net_device *dev,
struct ethtool_drvinfo *info) struct ethtool_drvinfo *info)
{ {
strncpy(info->driver, "ETRAX 100LX", sizeof(info->driver) - 1); strlcpy(info->driver, "ETRAX 100LX", sizeof(info->driver));
strncpy(info->version, "$Revision: 1.31 $", sizeof(info->version) - 1); strlcpy(info->version, "$Revision: 1.31 $", sizeof(info->version));
strncpy(info->fw_version, "N/A", sizeof(info->fw_version) - 1); strlcpy(info->fw_version, "N/A", sizeof(info->fw_version));
strncpy(info->bus_info, "N/A", sizeof(info->bus_info) - 1); strlcpy(info->bus_info, "N/A", sizeof(info->bus_info));
} }
static int e100_nway_reset(struct net_device *dev) static int e100_nway_reset(struct net_device *dev)

Просмотреть файл

@ -823,9 +823,10 @@ static void set_multicast_list(struct net_device *dev)
static void netdev_get_drvinfo(struct net_device *dev, static void netdev_get_drvinfo(struct net_device *dev,
struct ethtool_drvinfo *info) struct ethtool_drvinfo *info)
{ {
strcpy(info->driver, DRV_NAME); strlcpy(info->driver, DRV_NAME, sizeof(info->driver));
strcpy(info->version, DRV_VERSION); strlcpy(info->version, DRV_VERSION, sizeof(info->version));
sprintf(info->bus_info, "ISA 0x%lx", dev->base_addr); snprintf(info->bus_info, sizeof(info->bus_info), "ISA 0x%lx",
dev->base_addr);
} }
static u32 netdev_get_msglevel(struct net_device *dev) static u32 netdev_get_msglevel(struct net_device *dev)

Просмотреть файл

@ -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) static void el3_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info)
{ {
strcpy(info->driver, DRV_NAME); strlcpy(info->driver, DRV_NAME, sizeof(info->driver));
strcpy(info->version, DRV_VERSION); strlcpy(info->version, DRV_VERSION, sizeof(info->version));
} }
static int el3_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd) static int el3_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd)

Просмотреть файл

@ -1542,9 +1542,10 @@ static void set_rx_mode(struct net_device *dev)
static void netdev_get_drvinfo(struct net_device *dev, static void netdev_get_drvinfo(struct net_device *dev,
struct ethtool_drvinfo *info) struct ethtool_drvinfo *info)
{ {
strcpy(info->driver, DRV_NAME); strlcpy(info->driver, DRV_NAME, sizeof(info->driver));
strcpy(info->version, DRV_VERSION); strlcpy(info->version, DRV_VERSION, sizeof(info->version));
sprintf(info->bus_info, "ISA 0x%lx", dev->base_addr); snprintf(info->bus_info, sizeof(info->bus_info), "ISA 0x%lx",
dev->base_addr);
} }
static u32 netdev_get_msglevel(struct net_device *dev) static u32 netdev_get_msglevel(struct net_device *dev)

Просмотреть файл

@ -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, static void netdev_get_drvinfo(struct net_device *dev,
struct ethtool_drvinfo *info) struct ethtool_drvinfo *info)
{ {
strcpy(info->driver, DRV_NAME); strlcpy(info->driver, DRV_NAME, sizeof(info->driver));
strcpy(info->version, DRV_VERSION); strlcpy(info->version, DRV_VERSION, sizeof(info->version));
sprintf(info->bus_info, "ISA 0x%lx", dev->base_addr); snprintf(info->bus_info, sizeof(info->bus_info), "ISA 0x%lx",
dev->base_addr);
} }
static const struct ethtool_ops netdev_ethtool_ops = { static const struct ethtool_ops netdev_ethtool_ops = {

Просмотреть файл

@ -469,9 +469,9 @@ static void ax_get_drvinfo(struct net_device *dev,
{ {
struct platform_device *pdev = to_platform_device(dev->dev.parent); struct platform_device *pdev = to_platform_device(dev->dev.parent);
strcpy(info->driver, DRV_NAME); strlcpy(info->driver, DRV_NAME, sizeof(info->driver));
strcpy(info->version, DRV_VERSION); strlcpy(info->version, DRV_VERSION, sizeof(info->version));
strcpy(info->bus_info, pdev->name); strlcpy(info->bus_info, pdev->name, sizeof(info->bus_info));
} }
static int ax_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) static int ax_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)

Просмотреть файл

@ -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, static void bfin_mac_ethtool_getdrvinfo(struct net_device *dev,
struct ethtool_drvinfo *info) struct ethtool_drvinfo *info)
{ {
strcpy(info->driver, KBUILD_MODNAME); strlcpy(info->driver, KBUILD_MODNAME, sizeof(info->driver));
strcpy(info->version, DRV_VERSION); strlcpy(info->version, DRV_VERSION, sizeof(info->version));
strcpy(info->fw_version, "N/A"); strlcpy(info->fw_version, "N/A", sizeof(info->fw_version));
strcpy(info->bus_info, dev_name(&dev->dev)); strlcpy(info->bus_info, dev_name(&dev->dev), sizeof(info->bus_info));
} }
static void bfin_mac_ethtool_getwol(struct net_device *dev, static void bfin_mac_ethtool_getwol(struct net_device *dev,

Просмотреть файл

@ -1127,10 +1127,11 @@ static void greth_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *in
{ {
struct greth_private *greth = netdev_priv(dev); struct greth_private *greth = netdev_priv(dev);
strncpy(info->driver, dev_driver_string(greth->dev), 32); strlcpy(info->driver, dev_driver_string(greth->dev),
strncpy(info->version, "revision: 1.0", 32); sizeof(info->driver));
strncpy(info->bus_info, greth->dev->bus->name, 32); strlcpy(info->version, "revision: 1.0", sizeof(info->version));
strncpy(info->fw_version, "N/A", 32); 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->eedump_len = 0;
info->regdump_len = sizeof(struct greth_regs); info->regdump_len = sizeof(struct greth_regs);
} }

Просмотреть файл

@ -587,10 +587,10 @@ au1000_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info)
{ {
struct au1000_private *aup = netdev_priv(dev); struct au1000_private *aup = netdev_priv(dev);
strcpy(info->driver, DRV_NAME); strlcpy(info->driver, DRV_NAME, sizeof(info->driver));
strcpy(info->version, DRV_VERSION); strlcpy(info->version, DRV_VERSION, sizeof(info->version));
info->fw_version[0] = '\0'; snprintf(info->bus_info, sizeof(info->bus_info), "%s %d", DRV_NAME,
sprintf(info->bus_info, "%s %d", DRV_NAME, aup->mac_id); aup->mac_id);
info->regdump_len = 0; info->regdump_len = 0;
} }

Просмотреть файл

@ -1284,8 +1284,8 @@ static void lance_free_hwresources(struct lance_private *lp)
/* Ethtool support... */ /* Ethtool support... */
static void sparc_lance_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info) static void sparc_lance_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info)
{ {
strcpy(info->driver, "sunlance"); strlcpy(info->driver, "sunlance", sizeof(info->driver));
strcpy(info->version, "2.02"); strlcpy(info->version, "2.02", sizeof(info->version));
} }
static const struct ethtool_ops sparc_lance_ethtool_ops = { static const struct ethtool_ops sparc_lance_ethtool_ops = {

Просмотреть файл

@ -1227,10 +1227,11 @@ static const u32 unused_mib_regs[] = {
static void bcm_enet_get_drvinfo(struct net_device *netdev, static void bcm_enet_get_drvinfo(struct net_device *netdev,
struct ethtool_drvinfo *drvinfo) struct ethtool_drvinfo *drvinfo)
{ {
strncpy(drvinfo->driver, bcm_enet_driver_name, 32); strlcpy(drvinfo->driver, bcm_enet_driver_name, sizeof(drvinfo->driver));
strncpy(drvinfo->version, bcm_enet_driver_version, 32); strlcpy(drvinfo->version, bcm_enet_driver_version,
strncpy(drvinfo->fw_version, "N/A", 32); sizeof(drvinfo->version));
strncpy(drvinfo->bus_info, "bcm63xx", 32); 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; drvinfo->n_stats = BCM_ENET_STATS_LEN;
} }

Просмотреть файл

@ -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) static void ep93xx_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info)
{ {
strcpy(info->driver, DRV_MODULE_NAME); strlcpy(info->driver, DRV_MODULE_NAME, sizeof(info->driver));
strcpy(info->version, DRV_MODULE_VERSION); strlcpy(info->version, DRV_MODULE_VERSION, sizeof(info->version));
} }
static int ep93xx_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) static int ep93xx_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)

Просмотреть файл

@ -434,9 +434,10 @@ static void dm9000_get_drvinfo(struct net_device *dev,
{ {
board_info_t *dm = to_dm9000_board(dev); board_info_t *dm = to_dm9000_board(dev);
strcpy(info->driver, CARDNAME); strlcpy(info->driver, CARDNAME, sizeof(info->driver));
strcpy(info->version, DRV_VERSION); strlcpy(info->version, DRV_VERSION, sizeof(info->version));
strcpy(info->bus_info, to_platform_device(dm->dev)->name); strlcpy(info->bus_info, to_platform_device(dm->dev)->name,
sizeof(info->bus_info));
} }
static u32 dm9000_get_msglevel(struct net_device *dev) static u32 dm9000_get_msglevel(struct net_device *dev)

Просмотреть файл

@ -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); int fwrev = Read_EEPROM(dev->base_addr, EEPROM_REVLVL);
strcpy(info->driver, DRV_NAME); strlcpy(info->driver, DRV_NAME, sizeof(info->driver));
strcpy(info->version, DRV_VERSION); strlcpy(info->version, DRV_VERSION, sizeof(info->version));
sprintf(info->fw_version, "%d", fwrev); snprintf(info->fw_version, sizeof(info->fw_version), "%d", fwrev);
strcpy(info->bus_info, "N/A"); strlcpy(info->bus_info, "N/A", sizeof(info->bus_info));
info->eedump_len = EEPROM_MAX; info->eedump_len = EEPROM_MAX;
} }

Просмотреть файл

@ -1156,9 +1156,10 @@ set_multicast (struct net_device *dev)
static void rio_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info) static void rio_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info)
{ {
struct netdev_private *np = netdev_priv(dev); struct netdev_private *np = netdev_priv(dev);
strcpy(info->driver, "dl2k");
strcpy(info->version, DRV_VERSION); strlcpy(info->driver, "dl2k", sizeof(info->driver));
strcpy(info->bus_info, pci_name(np->pdev)); 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) static int rio_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)

Просмотреть файл

@ -183,12 +183,12 @@ static void be_get_drvinfo(struct net_device *netdev,
strlcpy(drvinfo->driver, DRV_NAME, sizeof(drvinfo->driver)); strlcpy(drvinfo->driver, DRV_NAME, sizeof(drvinfo->driver));
strlcpy(drvinfo->version, DRV_VER, sizeof(drvinfo->version)); 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))
if (memcmp(adapter->fw_ver, fw_on_flash, FW_VER_LEN) != 0) { strlcpy(drvinfo->fw_version, adapter->fw_ver,
strcat(drvinfo->fw_version, " ["); sizeof(drvinfo->fw_version));
strcat(drvinfo->fw_version, fw_on_flash); else
strcat(drvinfo->fw_version, "]"); snprintf(drvinfo->fw_version, sizeof(drvinfo->fw_version),
} "%s [%s]", adapter->fw_ver, fw_on_flash);
strlcpy(drvinfo->bus_info, pci_name(adapter->pdev), strlcpy(drvinfo->bus_info, pci_name(adapter->pdev),
sizeof(drvinfo->bus_info)); sizeof(drvinfo->bus_info));

Просмотреть файл

@ -955,9 +955,9 @@ static int ftgmac100_mdiobus_reset(struct mii_bus *bus)
static void ftgmac100_get_drvinfo(struct net_device *netdev, static void ftgmac100_get_drvinfo(struct net_device *netdev,
struct ethtool_drvinfo *info) struct ethtool_drvinfo *info)
{ {
strcpy(info->driver, DRV_NAME); strlcpy(info->driver, DRV_NAME, sizeof(info->driver));
strcpy(info->version, DRV_VERSION); strlcpy(info->version, DRV_VERSION, sizeof(info->version));
strcpy(info->bus_info, dev_name(&netdev->dev)); strlcpy(info->bus_info, dev_name(&netdev->dev), sizeof(info->bus_info));
} }
static int ftgmac100_get_settings(struct net_device *netdev, static int ftgmac100_get_settings(struct net_device *netdev,

Просмотреть файл

@ -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, static void ftmac100_get_drvinfo(struct net_device *netdev,
struct ethtool_drvinfo *info) struct ethtool_drvinfo *info)
{ {
strcpy(info->driver, DRV_NAME); strlcpy(info->driver, DRV_NAME, sizeof(info->driver));
strcpy(info->version, DRV_VERSION); strlcpy(info->version, DRV_VERSION, sizeof(info->version));
strcpy(info->bus_info, dev_name(&netdev->dev)); 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) static int ftmac100_get_settings(struct net_device *netdev, struct ethtool_cmd *cmd)

Просмотреть файл

@ -1168,9 +1168,10 @@ static void fec_enet_get_drvinfo(struct net_device *ndev,
{ {
struct fec_enet_private *fep = netdev_priv(ndev); struct fec_enet_private *fep = netdev_priv(ndev);
strcpy(info->driver, fep->pdev->dev.driver->name); strlcpy(info->driver, fep->pdev->dev.driver->name,
strcpy(info->version, "Revision: 1.0"); sizeof(info->driver));
strcpy(info->bus_info, dev_name(&ndev->dev)); 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 = { static const struct ethtool_ops fec_enet_ethtool_ops = {

Просмотреть файл

@ -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, static void fs_get_drvinfo(struct net_device *dev,
struct ethtool_drvinfo *info) struct ethtool_drvinfo *info)
{ {
strcpy(info->driver, DRV_MODULE_NAME); strlcpy(info->driver, DRV_MODULE_NAME, sizeof(info->driver));
strcpy(info->version, DRV_MODULE_VERSION); strlcpy(info->version, DRV_MODULE_VERSION, sizeof(info->version));
} }
static int fs_get_regs_len(struct net_device *dev) static int fs_get_regs_len(struct net_device *dev)

Просмотреть файл

@ -649,8 +649,6 @@ struct gfar_extra_stats {
/* Number of stats in the stats structure (ignore car and cam regs)*/ /* 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_STATS_LEN (GFAR_RMON_LEN + GFAR_EXTRA_STATS_LEN)
#define GFAR_INFOSTR_LEN 32
struct gfar_stats { struct gfar_stats {
u64 extra[GFAR_EXTRA_STATS_LEN]; u64 extra[GFAR_EXTRA_STATS_LEN];
u64 rmon[GFAR_RMON_LEN]; u64 rmon[GFAR_RMON_LEN];

Просмотреть файл

@ -184,10 +184,11 @@ static int gfar_sset_count(struct net_device *dev, int sset)
static void gfar_gdrvinfo(struct net_device *dev, static void gfar_gdrvinfo(struct net_device *dev,
struct ethtool_drvinfo *drvinfo) struct ethtool_drvinfo *drvinfo)
{ {
strncpy(drvinfo->driver, DRV_NAME, GFAR_INFOSTR_LEN); strlcpy(drvinfo->driver, DRV_NAME, sizeof(drvinfo->driver));
strncpy(drvinfo->version, gfar_driver_version, GFAR_INFOSTR_LEN); strlcpy(drvinfo->version, gfar_driver_version,
strncpy(drvinfo->fw_version, "N/A", GFAR_INFOSTR_LEN); sizeof(drvinfo->version));
strncpy(drvinfo->bus_info, "N/A", GFAR_INFOSTR_LEN); 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->regdump_len = 0;
drvinfo->eedump_len = 0; drvinfo->eedump_len = 0;
} }

Просмотреть файл

@ -350,10 +350,10 @@ static void
uec_get_drvinfo(struct net_device *netdev, uec_get_drvinfo(struct net_device *netdev,
struct ethtool_drvinfo *drvinfo) struct ethtool_drvinfo *drvinfo)
{ {
strncpy(drvinfo->driver, DRV_NAME, 32); strlcpy(drvinfo->driver, DRV_NAME, sizeof(drvinfo->driver));
strncpy(drvinfo->version, DRV_VERSION, 32); strlcpy(drvinfo->version, DRV_VERSION, sizeof(drvinfo->version));
strncpy(drvinfo->fw_version, "N/A", 32); strlcpy(drvinfo->fw_version, "N/A", sizeof(drvinfo->fw_version));
strncpy(drvinfo->bus_info, "QUICC ENGINE", 32); strlcpy(drvinfo->bus_info, "QUICC ENGINE", sizeof(drvinfo->bus_info));
drvinfo->eedump_len = 0; drvinfo->eedump_len = 0;
drvinfo->regdump_len = uec_get_regs_len(netdev); drvinfo->regdump_len = uec_get_regs_len(netdev);
} }

Просмотреть файл

@ -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, static void netdev_get_drvinfo(struct net_device *dev,
struct ethtool_drvinfo *info) struct ethtool_drvinfo *info)
{ {
strcpy(info->driver, DRV_NAME); strlcpy(info->driver, DRV_NAME, sizeof(info->driver));
strcpy(info->version, DRV_VERSION); strlcpy(info->version, DRV_VERSION, sizeof(info->version));
sprintf(info->bus_info, "ISA 0x%lx", dev->base_addr); snprintf(info->bus_info, sizeof(info->bus_info), "ISA 0x%lx",
dev->base_addr);
} }
static u32 netdev_get_msglevel(struct net_device *dev) static u32 netdev_get_msglevel(struct net_device *dev)

Просмотреть файл

@ -888,9 +888,10 @@ static void el16_rx(struct net_device *dev)
static void netdev_get_drvinfo(struct net_device *dev, static void netdev_get_drvinfo(struct net_device *dev,
struct ethtool_drvinfo *info) struct ethtool_drvinfo *info)
{ {
strcpy(info->driver, DRV_NAME); strlcpy(info->driver, DRV_NAME, sizeof(info->driver));
strcpy(info->version, DRV_VERSION); strlcpy(info->version, DRV_VERSION, sizeof(info->version));
sprintf(info->bus_info, "ISA 0x%lx", dev->base_addr); snprintf(info->bus_info, sizeof(info->bus_info), "ISA 0x%lx",
dev->base_addr);
} }
static u32 netdev_get_msglevel(struct net_device *dev) static u32 netdev_get_msglevel(struct net_device *dev)

Просмотреть файл

@ -2190,11 +2190,10 @@ static void emac_ethtool_get_drvinfo(struct net_device *ndev,
{ {
struct emac_instance *dev = netdev_priv(ndev); struct emac_instance *dev = netdev_priv(ndev);
strcpy(info->driver, "ibm_emac"); strlcpy(info->driver, "ibm_emac", sizeof(info->driver));
strcpy(info->version, DRV_VERSION); strlcpy(info->version, DRV_VERSION, sizeof(info->version));
info->fw_version[0] = '\0'; snprintf(info->bus_info, sizeof(info->bus_info), "PPC 4xx EMAC-%d %s",
sprintf(info->bus_info, "PPC 4xx EMAC-%d %s", dev->cell_index, dev->ofdev->dev.of_node->full_name);
dev->cell_index, dev->ofdev->dev.of_node->full_name);
info->regdump_len = emac_ethtool_get_regs_len(ndev); info->regdump_len = emac_ethtool_get_regs_len(ndev);
} }

Просмотреть файл

@ -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, static void netdev_get_drvinfo(struct net_device *dev,
struct ethtool_drvinfo *info) struct ethtool_drvinfo *info)
{ {
strncpy(info->driver, ibmveth_driver_name, sizeof(info->driver) - 1); strlcpy(info->driver, ibmveth_driver_name, sizeof(info->driver));
strncpy(info->version, ibmveth_driver_version, strlcpy(info->version, ibmveth_driver_version, sizeof(info->version));
sizeof(info->version) - 1);
} }
static netdev_features_t ibmveth_fix_features(struct net_device *dev, static netdev_features_t ibmveth_fix_features(struct net_device *dev,

Просмотреть файл

@ -695,9 +695,9 @@ static void netdev_get_drvinfo(struct net_device *dev,
{ {
struct korina_private *lp = netdev_priv(dev); struct korina_private *lp = netdev_priv(dev);
strcpy(info->driver, DRV_NAME); strlcpy(info->driver, DRV_NAME, sizeof(info->driver));
strcpy(info->version, DRV_VERSION); strlcpy(info->version, DRV_VERSION, sizeof(info->version));
strcpy(info->bus_info, lp->dev->name); strlcpy(info->bus_info, lp->dev->name, sizeof(info->bus_info));
} }
static int netdev_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) static int netdev_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)

Просмотреть файл

@ -302,9 +302,9 @@ ltq_etop_hw_init(struct net_device *dev)
static void static void
ltq_etop_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info) ltq_etop_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info)
{ {
strcpy(info->driver, "Lantiq ETOP"); strlcpy(info->driver, "Lantiq ETOP", sizeof(info->driver));
strcpy(info->bus_info, "internal"); strlcpy(info->bus_info, "internal", sizeof(info->bus_info));
strcpy(info->version, DRV_VERSION); strlcpy(info->version, DRV_VERSION, sizeof(info->version));
} }
static int static int

Просмотреть файл

@ -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, static void pxa168_get_drvinfo(struct net_device *dev,
struct ethtool_drvinfo *info) struct ethtool_drvinfo *info)
{ {
strncpy(info->driver, DRIVER_NAME, 32); strlcpy(info->driver, DRIVER_NAME, sizeof(info->driver));
strncpy(info->version, DRIVER_VERSION, 32); strlcpy(info->version, DRIVER_VERSION, sizeof(info->version));
strncpy(info->fw_version, "N/A", 32); strlcpy(info->fw_version, "N/A", sizeof(info->fw_version));
strncpy(info->bus_info, "N/A", 32); strlcpy(info->bus_info, "N/A", sizeof(info->bus_info));
} }
static const struct ethtool_ops pxa168_ethtool_ops = { static const struct ethtool_ops pxa168_ethtool_ops = {

Просмотреть файл

@ -82,9 +82,9 @@ static void vxge_ethtool_gdrvinfo(struct net_device *dev,
struct ethtool_drvinfo *info) struct ethtool_drvinfo *info)
{ {
struct vxgedev *vdev = netdev_priv(dev); struct vxgedev *vdev = netdev_priv(dev);
strlcpy(info->driver, VXGE_DRIVER_NAME, sizeof(VXGE_DRIVER_NAME)); strlcpy(info->driver, VXGE_DRIVER_NAME, sizeof(info->driver));
strlcpy(info->version, DRV_VERSION, sizeof(DRV_VERSION)); strlcpy(info->version, DRV_VERSION, sizeof(info->version));
strlcpy(info->fw_version, vdev->fw_version, VXGE_HW_FW_STRLEN); strlcpy(info->fw_version, vdev->fw_version, sizeof(info->fw_version));
strlcpy(info->bus_info, pci_name(vdev->pdev), sizeof(info->bus_info)); strlcpy(info->bus_info, pci_name(vdev->pdev), sizeof(info->bus_info));
info->regdump_len = sizeof(struct vxge_hw_vpath_reg) info->regdump_len = sizeof(struct vxge_hw_vpath_reg)
* vdev->no_of_vpath; * vdev->no_of_vpath;

Просмотреть файл

@ -878,8 +878,8 @@ static int w90p910_ether_ioctl(struct net_device *dev,
static void w90p910_get_drvinfo(struct net_device *dev, static void w90p910_get_drvinfo(struct net_device *dev,
struct ethtool_drvinfo *info) struct ethtool_drvinfo *info)
{ {
strcpy(info->driver, DRV_MODULE_NAME); strlcpy(info->driver, DRV_MODULE_NAME, sizeof(info->driver));
strcpy(info->version, DRV_MODULE_VERSION); strlcpy(info->version, DRV_MODULE_VERSION, sizeof(info->version));
} }
static int w90p910_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) static int w90p910_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)

Просмотреть файл

@ -1239,9 +1239,10 @@ static int lpc_eth_open(struct net_device *ndev)
static void lpc_eth_ethtool_getdrvinfo(struct net_device *ndev, static void lpc_eth_ethtool_getdrvinfo(struct net_device *ndev,
struct ethtool_drvinfo *info) struct ethtool_drvinfo *info)
{ {
strcpy(info->driver, MODNAME); strlcpy(info->driver, MODNAME, sizeof(info->driver));
strcpy(info->version, DRV_VERSION); strlcpy(info->version, DRV_VERSION, sizeof(info->version));
strcpy(info->bus_info, dev_name(ndev->dev.parent)); strlcpy(info->bus_info, dev_name(ndev->dev.parent),
sizeof(info->bus_info));
} }
static u32 lpc_eth_ethtool_getmsglevel(struct net_device *ndev) static u32 lpc_eth_ethtool_getmsglevel(struct net_device *ndev)

Просмотреть файл

@ -1350,10 +1350,10 @@ static void octeon_mgmt_poll_controller(struct net_device *netdev)
static void octeon_mgmt_get_drvinfo(struct net_device *netdev, static void octeon_mgmt_get_drvinfo(struct net_device *netdev,
struct ethtool_drvinfo *info) struct ethtool_drvinfo *info)
{ {
strncpy(info->driver, DRV_NAME, sizeof(info->driver)); strlcpy(info->driver, DRV_NAME, sizeof(info->driver));
strncpy(info->version, DRV_VERSION, sizeof(info->version)); strlcpy(info->version, DRV_VERSION, sizeof(info->version));
strncpy(info->fw_version, "N/A", sizeof(info->fw_version)); strlcpy(info->fw_version, "N/A", sizeof(info->fw_version));
strncpy(info->bus_info, "N/A", sizeof(info->bus_info)); strlcpy(info->bus_info, "N/A", sizeof(info->bus_info));
info->n_stats = 0; info->n_stats = 0;
info->testinfo_len = 0; info->testinfo_len = 0;
info->regdump_len = 0; info->regdump_len = 0;

Просмотреть файл

@ -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) static void hamachi_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info)
{ {
struct hamachi_private *np = netdev_priv(dev); struct hamachi_private *np = netdev_priv(dev);
strcpy(info->driver, DRV_NAME);
strcpy(info->version, DRV_VERSION); strlcpy(info->driver, DRV_NAME, sizeof(info->driver));
strcpy(info->bus_info, pci_name(np->pci_dev)); 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) static int hamachi_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd)

Просмотреть файл

@ -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) static void yellowfin_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info)
{ {
struct yellowfin_private *np = netdev_priv(dev); struct yellowfin_private *np = netdev_priv(dev);
strcpy(info->driver, DRV_NAME);
strcpy(info->version, DRV_VERSION); strlcpy(info->driver, DRV_NAME, sizeof(info->driver));
strcpy(info->bus_info, pci_name(np->pci_dev)); 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 = { static const struct ethtool_ops ethtool_ops = {

Просмотреть файл

@ -957,9 +957,9 @@ static void netdev_get_drvinfo(struct net_device *dev,
{ {
struct r6040_private *rp = netdev_priv(dev); struct r6040_private *rp = netdev_priv(dev);
strcpy(info->driver, DRV_NAME); strlcpy(info->driver, DRV_NAME, sizeof(info->driver));
strcpy(info->version, DRV_VERSION); strlcpy(info->version, DRV_VERSION, sizeof(info->version));
strcpy(info->bus_info, pci_name(rp->pdev)); 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) static int netdev_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)

Просмотреть файл

@ -1565,9 +1565,9 @@ static void ioc3_get_drvinfo (struct net_device *dev,
{ {
struct ioc3_private *ip = netdev_priv(dev); struct ioc3_private *ip = netdev_priv(dev);
strcpy (info->driver, IOC3_NAME); strlcpy(info->driver, IOC3_NAME, sizeof(info->driver));
strcpy (info->version, IOC3_VERSION); strlcpy(info->version, IOC3_VERSION, sizeof(info->version));
strcpy (info->bus_info, pci_name(ip->pdev)); 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) static int ioc3_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)

Просмотреть файл

@ -1522,9 +1522,10 @@ smc911x_ethtool_setsettings(struct net_device *dev, struct ethtool_cmd *cmd)
static void static void
smc911x_ethtool_getdrvinfo(struct net_device *dev, struct ethtool_drvinfo *info) smc911x_ethtool_getdrvinfo(struct net_device *dev, struct ethtool_drvinfo *info)
{ {
strncpy(info->driver, CARDNAME, sizeof(info->driver)); strlcpy(info->driver, CARDNAME, sizeof(info->driver));
strncpy(info->version, version, sizeof(info->version)); strlcpy(info->version, version, sizeof(info->version));
strncpy(info->bus_info, dev_name(dev->dev.parent), sizeof(info->bus_info)); strlcpy(info->bus_info, dev_name(dev->dev.parent),
sizeof(info->bus_info));
} }
static int smc911x_ethtool_nwayreset(struct net_device *dev) static int smc911x_ethtool_nwayreset(struct net_device *dev)

Просмотреть файл

@ -1597,9 +1597,10 @@ smc_ethtool_setsettings(struct net_device *dev, struct ethtool_cmd *cmd)
static void static void
smc_ethtool_getdrvinfo(struct net_device *dev, struct ethtool_drvinfo *info) smc_ethtool_getdrvinfo(struct net_device *dev, struct ethtool_drvinfo *info)
{ {
strncpy(info->driver, CARDNAME, sizeof(info->driver)); strlcpy(info->driver, CARDNAME, sizeof(info->driver));
strncpy(info->version, version, sizeof(info->version)); strlcpy(info->version, version, sizeof(info->version));
strncpy(info->bus_info, dev_name(dev->dev.parent), sizeof(info->bus_info)); strlcpy(info->bus_info, dev_name(dev->dev.parent),
sizeof(info->bus_info));
} }
static int smc_ethtool_nwayreset(struct net_device *dev) static int smc_ethtool_nwayreset(struct net_device *dev)

Просмотреть файл

@ -210,8 +210,7 @@ static void stmmac_ethtool_getdrvinfo(struct net_device *dev,
strlcpy(info->driver, MAC100_ETHTOOL_NAME, strlcpy(info->driver, MAC100_ETHTOOL_NAME,
sizeof(info->driver)); sizeof(info->driver));
strcpy(info->version, DRV_MODULE_VERSION); strlcpy(info->version, DRV_MODULE_VERSION, sizeof(info->version));
info->fw_version[0] = '\0';
} }
static int stmmac_ethtool_getsettings(struct net_device *dev, static int stmmac_ethtool_getsettings(struct net_device *dev,

Просмотреть файл

@ -1042,8 +1042,8 @@ static void bigmac_set_multicast(struct net_device *dev)
/* Ethtool support... */ /* Ethtool support... */
static void bigmac_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info) static void bigmac_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info)
{ {
strcpy(info->driver, "sunbmac"); strlcpy(info->driver, "sunbmac", sizeof(info->driver));
strcpy(info->version, "2.0"); strlcpy(info->version, "2.0", sizeof(info->version));
} }
static u32 bigmac_get_link(struct net_device *dev) static u32 bigmac_get_link(struct net_device *dev)

Просмотреть файл

@ -685,13 +685,14 @@ static void qe_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info)
struct sunqe *qep = netdev_priv(dev); struct sunqe *qep = netdev_priv(dev);
struct platform_device *op; struct platform_device *op;
strcpy(info->driver, "sunqe"); strlcpy(info->driver, "sunqe", sizeof(info->driver));
strcpy(info->version, "3.0"); strlcpy(info->version, "3.0", sizeof(info->version));
op = qep->op; op = qep->op;
regs = of_get_property(op->dev.of_node, "reg", NULL); regs = of_get_property(op->dev.of_node, "reg", NULL);
if (regs) if (regs)
sprintf(info->bus_info, "SBUS:%d", regs->which_io); snprintf(info->bus_info, sizeof(info->bus_info), "SBUS:%d",
regs->which_io);
} }

Просмотреть файл

@ -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, static void vnet_get_drvinfo(struct net_device *dev,
struct ethtool_drvinfo *info) struct ethtool_drvinfo *info)
{ {
strcpy(info->driver, DRV_MODULE_NAME); strlcpy(info->driver, DRV_MODULE_NAME, sizeof(info->driver));
strcpy(info->version, DRV_MODULE_VERSION); strlcpy(info->version, DRV_MODULE_VERSION, sizeof(info->version));
} }
static u32 vnet_get_msglevel(struct net_device *dev) static u32 vnet_get_msglevel(struct net_device *dev)

Просмотреть файл

@ -2179,10 +2179,10 @@ bdx_get_drvinfo(struct net_device *netdev, struct ethtool_drvinfo *drvinfo)
{ {
struct bdx_priv *priv = netdev_priv(netdev); struct bdx_priv *priv = netdev_priv(netdev);
strlcat(drvinfo->driver, BDX_DRV_NAME, sizeof(drvinfo->driver)); strlcpy(drvinfo->driver, BDX_DRV_NAME, sizeof(drvinfo->driver));
strlcat(drvinfo->version, BDX_DRV_VERSION, sizeof(drvinfo->version)); strlcpy(drvinfo->version, BDX_DRV_VERSION, sizeof(drvinfo->version));
strlcat(drvinfo->fw_version, "N/A", sizeof(drvinfo->fw_version)); strlcpy(drvinfo->fw_version, "N/A", sizeof(drvinfo->fw_version));
strlcat(drvinfo->bus_info, pci_name(priv->pdev), strlcpy(drvinfo->bus_info, pci_name(priv->pdev),
sizeof(drvinfo->bus_info)); sizeof(drvinfo->bus_info));
drvinfo->n_stats = ((priv->stats_flag) ? ARRAY_SIZE(bdx_stat_names) : 0); drvinfo->n_stats = ((priv->stats_flag) ? ARRAY_SIZE(bdx_stat_names) : 0);

Просмотреть файл

@ -904,10 +904,9 @@ static int cpmac_set_ringparam(struct net_device *dev,
static void cpmac_get_drvinfo(struct net_device *dev, static void cpmac_get_drvinfo(struct net_device *dev,
struct ethtool_drvinfo *info) struct ethtool_drvinfo *info)
{ {
strcpy(info->driver, "cpmac"); strlcpy(info->driver, "cpmac", sizeof(info->driver));
strcpy(info->version, CPMAC_VERSION); strlcpy(info->version, CPMAC_VERSION, sizeof(info->version));
info->fw_version[0] = '\0'; snprintf(info->bus_info, sizeof(info->bus_info), "%s", "cpmac");
sprintf(info->bus_info, "%s", "cpmac");
info->regdump_len = 0; info->regdump_len = 0;
} }

Просмотреть файл

@ -944,9 +944,10 @@ static void cpsw_get_drvinfo(struct net_device *ndev,
struct ethtool_drvinfo *info) struct ethtool_drvinfo *info)
{ {
struct cpsw_priv *priv = netdev_priv(ndev); struct cpsw_priv *priv = netdev_priv(ndev);
strcpy(info->driver, "TI CPSW Driver v1.0");
strcpy(info->version, "1.0"); strlcpy(info->driver, "TI CPSW Driver v1.0", sizeof(info->driver));
strcpy(info->bus_info, priv->pdev->name); 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) static u32 cpsw_get_msglevel(struct net_device *ndev)

Просмотреть файл

@ -480,8 +480,8 @@ static void emac_dump_regs(struct emac_priv *priv)
static void emac_get_drvinfo(struct net_device *ndev, static void emac_get_drvinfo(struct net_device *ndev,
struct ethtool_drvinfo *info) struct ethtool_drvinfo *info)
{ {
strcpy(info->driver, emac_version_string); strlcpy(info->driver, emac_version_string, sizeof(info->driver));
strcpy(info->version, EMAC_MODULE_VERSION); strlcpy(info->version, EMAC_MODULE_VERSION, sizeof(info->version));
} }
/** /**

Просмотреть файл

@ -1226,8 +1226,8 @@ int gelic_net_open(struct net_device *netdev)
void gelic_net_get_drvinfo(struct net_device *netdev, void gelic_net_get_drvinfo(struct net_device *netdev,
struct ethtool_drvinfo *info) struct ethtool_drvinfo *info)
{ {
strncpy(info->driver, DRV_NAME, sizeof(info->driver) - 1); strlcpy(info->driver, DRV_NAME, sizeof(info->driver));
strncpy(info->version, DRV_VERSION, sizeof(info->version) - 1); strlcpy(info->version, DRV_VERSION, sizeof(info->version));
} }
static int gelic_ether_get_settings(struct net_device *netdev, static int gelic_ether_get_settings(struct net_device *netdev,

Просмотреть файл

@ -72,11 +72,13 @@ spider_net_ethtool_get_drvinfo(struct net_device *netdev,
card = netdev_priv(netdev); card = netdev_priv(netdev);
/* clear and fill out info */ /* clear and fill out info */
memset(drvinfo, 0, sizeof(struct ethtool_drvinfo)); strlcpy(drvinfo->driver, spider_net_driver_name,
strncpy(drvinfo->driver, spider_net_driver_name, 32); sizeof(drvinfo->driver));
strncpy(drvinfo->version, VERSION, 32); strlcpy(drvinfo->version, VERSION, sizeof(drvinfo->version));
strcpy(drvinfo->fw_version, "no information"); strlcpy(drvinfo->fw_version, "no information",
strncpy(drvinfo->bus_info, pci_name(card->pdev), 32); sizeof(drvinfo->fw_version));
strlcpy(drvinfo->bus_info, pci_name(card->pdev),
sizeof(drvinfo->bus_info));
} }
static void static void

Просмотреть файл

@ -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) static void tc35815_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info)
{ {
struct tc35815_local *lp = netdev_priv(dev); struct tc35815_local *lp = netdev_priv(dev);
strcpy(info->driver, MODNAME);
strcpy(info->version, DRV_VERSION); strlcpy(info->driver, MODNAME, sizeof(info->driver));
strcpy(info->bus_info, pci_name(lp->pci_dev)); 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) static int tc35815_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)

Просмотреть файл

@ -1124,9 +1124,8 @@ static int axienet_ethtools_set_settings(struct net_device *ndev,
static void axienet_ethtools_get_drvinfo(struct net_device *ndev, static void axienet_ethtools_get_drvinfo(struct net_device *ndev,
struct ethtool_drvinfo *ed) struct ethtool_drvinfo *ed)
{ {
memset(ed, 0, sizeof(struct ethtool_drvinfo)); strlcpy(ed->driver, DRIVER_NAME, sizeof(ed->driver));
strcpy(ed->driver, DRIVER_NAME); strlcpy(ed->version, DRIVER_VERSION, sizeof(ed->version));
strcpy(ed->version, DRIVER_VERSION);
ed->regdump_len = sizeof(u32) * AXIENET_REGS_N; ed->regdump_len = sizeof(u32) * AXIENET_REGS_N;
} }

Просмотреть файл

@ -1412,7 +1412,8 @@ static void netdev_get_drvinfo(struct net_device *dev,
struct ethtool_drvinfo *info) struct ethtool_drvinfo *info)
{ {
strlcpy(info->driver, "xirc2ps_cs", sizeof(info->driver)); 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 = { static const struct ethtool_ops netdev_ethtool_ops = {

Просмотреть файл

@ -977,11 +977,12 @@ static void ixp4xx_get_drvinfo(struct net_device *dev,
struct ethtool_drvinfo *info) struct ethtool_drvinfo *info)
{ {
struct port *port = netdev_priv(dev); 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", snprintf(info->fw_version, sizeof(info->fw_version), "%u:%u:%u:%u",
port->firmware[0], port->firmware[1], port->firmware[0], port->firmware[1],
port->firmware[2], port->firmware[3]); 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) static int ixp4xx_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)

Просмотреть файл

@ -304,9 +304,9 @@ int netvsc_recv_callback(struct hv_device *device_obj,
static void netvsc_get_drvinfo(struct net_device *net, static void netvsc_get_drvinfo(struct net_device *net,
struct ethtool_drvinfo *info) struct ethtool_drvinfo *info)
{ {
strcpy(info->driver, KBUILD_MODNAME); strlcpy(info->driver, KBUILD_MODNAME, sizeof(info->driver));
strcpy(info->version, HV_DRV_VERSION); strlcpy(info->version, HV_DRV_VERSION, sizeof(info->version));
strcpy(info->fw_version, "N/A"); strlcpy(info->fw_version, "N/A", sizeof(info->fw_version));
} }
static int netvsc_change_mtu(struct net_device *ndev, int mtu) static int netvsc_change_mtu(struct net_device *ndev, int mtu)

Просмотреть файл

@ -585,8 +585,8 @@ static int macvlan_fdb_del(struct ndmsg *ndm,
static void macvlan_ethtool_get_drvinfo(struct net_device *dev, static void macvlan_ethtool_get_drvinfo(struct net_device *dev,
struct ethtool_drvinfo *drvinfo) struct ethtool_drvinfo *drvinfo)
{ {
snprintf(drvinfo->driver, 32, "macvlan"); strlcpy(drvinfo->driver, "macvlan", sizeof(drvinfo->driver));
snprintf(drvinfo->version, 32, "0.1"); strlcpy(drvinfo->version, "0.1", sizeof(drvinfo->version));
} }
static int macvlan_ethtool_get_settings(struct net_device *dev, static int macvlan_ethtool_get_settings(struct net_device *dev,

Просмотреть файл

@ -410,10 +410,10 @@ static void rionet_get_drvinfo(struct net_device *ndev,
{ {
struct rionet_private *rnet = netdev_priv(ndev); struct rionet_private *rnet = netdev_priv(ndev);
strcpy(info->driver, DRV_NAME); strlcpy(info->driver, DRV_NAME, sizeof(info->driver));
strcpy(info->version, DRV_VERSION); strlcpy(info->version, DRV_VERSION, sizeof(info->version));
strcpy(info->fw_version, "n/a"); strlcpy(info->fw_version, "n/a", sizeof(info->fw_version));
strcpy(info->bus_info, rnet->mport->name); strlcpy(info->bus_info, rnet->mport->name, sizeof(info->bus_info));
} }
static u32 rionet_get_msglevel(struct net_device *ndev) static u32 rionet_get_msglevel(struct net_device *ndev)

Просмотреть файл

@ -510,8 +510,8 @@ void asix_get_drvinfo(struct net_device *net, struct ethtool_drvinfo *info)
{ {
/* Inherit standard device info */ /* Inherit standard device info */
usbnet_get_drvinfo(net, info); usbnet_get_drvinfo(net, info);
strncpy (info->driver, DRIVER_NAME, sizeof info->driver); strlcpy(info->driver, DRIVER_NAME, sizeof(info->driver));
strncpy (info->version, DRIVER_VERSION, sizeof info->version); strlcpy(info->version, DRIVER_VERSION, sizeof(info->version));
info->eedump_len = AX_EEPROM_LEN; info->eedump_len = AX_EEPROM_LEN;
} }

Просмотреть файл

@ -685,9 +685,9 @@ static void catc_get_drvinfo(struct net_device *dev,
struct ethtool_drvinfo *info) struct ethtool_drvinfo *info)
{ {
struct catc *catc = netdev_priv(dev); struct catc *catc = netdev_priv(dev);
strncpy(info->driver, driver_name, ETHTOOL_BUSINFO_LEN); strlcpy(info->driver, driver_name, sizeof(info->driver));
strncpy(info->version, DRIVER_VERSION, ETHTOOL_BUSINFO_LEN); strlcpy(info->version, DRIVER_VERSION, sizeof(info->version));
usb_make_path (catc->usbdev, info->bus_info, sizeof info->bus_info); 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) static int catc_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)

Просмотреть файл

@ -65,9 +65,9 @@ cdc_ncm_get_drvinfo(struct net_device *net, struct ethtool_drvinfo *info)
{ {
struct usbnet *dev = netdev_priv(net); struct usbnet *dev = netdev_priv(net);
strncpy(info->driver, dev->driver_name, sizeof(info->driver)); strlcpy(info->driver, dev->driver_name, sizeof(info->driver));
strncpy(info->version, DRIVER_VERSION, sizeof(info->version)); strlcpy(info->version, DRIVER_VERSION, sizeof(info->version));
strncpy(info->fw_version, dev->driver_info->description, strlcpy(info->fw_version, dev->driver_info->description,
sizeof(info->fw_version)); sizeof(info->fw_version));
usb_make_path(dev->udev, info->bus_info, sizeof(info->bus_info)); usb_make_path(dev->udev, info->bus_info, sizeof(info->bus_info));
} }

Просмотреть файл

@ -1074,8 +1074,9 @@ static void pegasus_get_drvinfo(struct net_device *dev,
struct ethtool_drvinfo *info) struct ethtool_drvinfo *info)
{ {
pegasus_t *pegasus = netdev_priv(dev); 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)); usb_make_path(pegasus->usb, info->bus_info, sizeof(info->bus_info));
} }

Просмотреть файл

@ -776,9 +776,9 @@ static void rtl8150_get_drvinfo(struct net_device *netdev, struct ethtool_drvinf
{ {
rtl8150_t *dev = netdev_priv(netdev); rtl8150_t *dev = netdev_priv(netdev);
strncpy(info->driver, driver_name, ETHTOOL_BUSINFO_LEN); strlcpy(info->driver, driver_name, sizeof(info->driver));
strncpy(info->version, DRIVER_VERSION, ETHTOOL_BUSINFO_LEN); strlcpy(info->version, DRIVER_VERSION, sizeof(info->version));
usb_make_path(dev->udev, info->bus_info, sizeof info->bus_info); 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) static int rtl8150_get_settings(struct net_device *netdev, struct ethtool_cmd *ecmd)

Просмотреть файл

@ -598,8 +598,8 @@ static void sierra_net_get_drvinfo(struct net_device *net,
{ {
/* Inherit standard device info */ /* Inherit standard device info */
usbnet_get_drvinfo(net, info); usbnet_get_drvinfo(net, info);
strncpy(info->driver, driver_name, sizeof info->driver); strlcpy(info->driver, driver_name, sizeof(info->driver));
strncpy(info->version, DRIVER_VERSION, sizeof info->version); strlcpy(info->version, DRIVER_VERSION, sizeof(info->version));
} }
static u32 sierra_net_get_link(struct net_device *net) static u32 sierra_net_get_link(struct net_device *net)

Просмотреть файл

@ -207,7 +207,7 @@ vmxnet3_get_drvinfo(struct net_device *netdev, struct ethtool_drvinfo *drvinfo)
sizeof(drvinfo->version)); sizeof(drvinfo->version));
strlcpy(drvinfo->bus_info, pci_name(adapter->pdev), 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->n_stats = vmxnet3_get_sset_count(netdev, ETH_SS_STATS);
drvinfo->testinfo_len = 0; drvinfo->testinfo_len = 0;
drvinfo->eedump_len = 0; drvinfo->eedump_len = 0;

Просмотреть файл

@ -596,12 +596,12 @@ static void i2400m_get_drvinfo(struct net_device *net_dev,
{ {
struct i2400m *i2400m = net_dev_to_i2400m(net_dev); struct i2400m *i2400m = net_dev_to_i2400m(net_dev);
strncpy(info->driver, KBUILD_MODNAME, sizeof(info->driver) - 1); strlcpy(info->driver, KBUILD_MODNAME, sizeof(info->driver));
strncpy(info->fw_version, strlcpy(info->fw_version, i2400m->fw_name ? : "",
i2400m->fw_name ? : "", sizeof(info->fw_version) - 1); sizeof(info->fw_version));
if (net_dev->dev.parent) if (net_dev->dev.parent)
strncpy(info->bus_info, dev_name(net_dev->dev.parent), strlcpy(info->bus_info, dev_name(net_dev->dev.parent),
sizeof(info->bus_info) - 1); sizeof(info->bus_info));
} }
static const struct ethtool_ops i2400m_ethtool_ops = { static const struct ethtool_ops i2400m_ethtool_ops = {

Просмотреть файл

@ -346,9 +346,9 @@ static void i2400mu_get_drvinfo(struct net_device *net_dev,
struct i2400mu *i2400mu = container_of(i2400m, struct i2400mu, i2400m); struct i2400mu *i2400mu = container_of(i2400m, struct i2400mu, i2400m);
struct usb_device *udev = i2400mu->usb_dev; struct usb_device *udev = i2400mu->usb_dev;
strncpy(info->driver, KBUILD_MODNAME, sizeof(info->driver) - 1); strlcpy(info->driver, KBUILD_MODNAME, sizeof(info->driver));
strncpy(info->fw_version, strlcpy(info->fw_version, i2400m->fw_name ? : "",
i2400m->fw_name ? : "", sizeof(info->fw_version) - 1); sizeof(info->fw_version));
usb_make_path(udev, info->bus_info, sizeof(info->bus_info)); usb_make_path(udev, info->bus_info, sizeof(info->bus_info));
} }

Просмотреть файл

@ -395,9 +395,11 @@ static void brcmf_ethtool_get_drvinfo(struct net_device *ndev,
struct brcmf_if *ifp = netdev_priv(ndev); struct brcmf_if *ifp = netdev_priv(ndev);
struct brcmf_pub *drvr = ifp->drvr; struct brcmf_pub *drvr = ifp->drvr;
sprintf(info->driver, KBUILD_MODNAME); strlcpy(info->driver, KBUILD_MODNAME, sizeof(info->driver));
sprintf(info->version, "%lu", drvr->drv_version); snprintf(info->version, sizeof(info->version), "%lu",
sprintf(info->bus_info, "%s", dev_name(drvr->bus_if->dev)); 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 = { static const struct ethtool_ops brcmf_ethtool_ops = {

Просмотреть файл

@ -5444,17 +5444,14 @@ void qeth_core_get_drvinfo(struct net_device *dev,
struct ethtool_drvinfo *info) struct ethtool_drvinfo *info)
{ {
struct qeth_card *card = dev->ml_priv; 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"); strlcpy(info->driver, card->options.layer2 ? "qeth_l2" : "qeth_l3",
strcpy(info->fw_version, card->info.mcl_level); sizeof(info->driver));
sprintf(info->bus_info, "%s/%s/%s", strlcpy(info->version, "1.0", sizeof(info->version));
CARD_RDEV_ID(card), strlcpy(info->fw_version, card->info.mcl_level,
CARD_WDEV_ID(card), sizeof(info->fw_version));
CARD_DDEV_ID(card)); 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); EXPORT_SYMBOL_GPL(qeth_core_get_drvinfo);

Просмотреть файл

@ -145,8 +145,8 @@ static void bcm_get_drvinfo(struct net_device *dev,
struct bcm_interface_adapter *psIntfAdapter = Adapter->pvInterfaceAdapter; struct bcm_interface_adapter *psIntfAdapter = Adapter->pvInterfaceAdapter;
struct usb_device *udev = interface_to_usbdev(psIntfAdapter->interface); struct usb_device *udev = interface_to_usbdev(psIntfAdapter->interface);
strcpy(info->driver, DRV_NAME); strlcpy(info->driver, DRV_NAME, sizeof(info->driver));
strcpy(info->version, DRV_VERSION); strlcpy(info->version, DRV_VERSION, sizeof(info->version));
snprintf(info->fw_version, sizeof(info->fw_version), "%u.%u", snprintf(info->fw_version, sizeof(info->fw_version), "%u.%u",
Adapter->uiFlashLayoutMajorVersion, Adapter->uiFlashLayoutMajorVersion,
Adapter->uiFlashLayoutMinorVersion); Adapter->uiFlashLayoutMinorVersion);

Просмотреть файл

@ -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) 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->driver, "g_ether", sizeof(p->driver));
strlcpy(p->version, UETH__VERSION, sizeof p->version); strlcpy(p->version, UETH__VERSION, sizeof(p->version));
strlcpy(p->fw_version, dev->gadget->name, sizeof p->fw_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->bus_info, dev_name(&dev->gadget->dev), sizeof(p->bus_info));
} }
/* REVISIT can also support: /* REVISIT can also support:

Просмотреть файл

@ -3560,15 +3560,15 @@ static void et131x_get_regs(struct net_device *netdev,
regs_buff[num++] = readl(&aregs->rxdma.fbr1_min_des); 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, static void et131x_get_drvinfo(struct net_device *netdev,
struct ethtool_drvinfo *info) struct ethtool_drvinfo *info)
{ {
struct et131x_adapter *adapter = netdev_priv(netdev); struct et131x_adapter *adapter = netdev_priv(netdev);
strncpy(info->driver, DRIVER_NAME, ET131X_DRVINFO_LEN); strlcpy(info->driver, DRIVER_NAME, sizeof(info->driver));
strncpy(info->version, DRIVER_VERSION, ET131X_DRVINFO_LEN); strlcpy(info->version, DRIVER_VERSION, sizeof(info->version));
strncpy(info->bus_info, pci_name(adapter->pdev), ET131X_DRVINFO_LEN); strlcpy(info->bus_info, pci_name(adapter->pdev),
sizeof(info->bus_info));
} }
static struct ethtool_ops et131x_ethtool_ops = { static struct ethtool_ops et131x_ethtool_ops = {

Просмотреть файл

@ -2077,11 +2077,12 @@ static void ft1000_get_drvinfo(struct net_device *dev,
struct ft1000_info *ft_info; struct ft1000_info *ft_info;
ft_info = netdev_priv(dev); ft_info = netdev_priv(dev);
snprintf(info->driver, 32, "ft1000"); strlcpy(info->driver, "ft1000", sizeof(info->driver));
snprintf(info->bus_info, ETHTOOL_BUSINFO_LEN, "PCMCIA 0x%lx", snprintf(info->bus_info, sizeof(info->bus_info), "PCMCIA 0x%lx",
dev->base_addr); dev->base_addr);
snprintf(info->fw_version, 32, "%d.%d.%d.%d", ft_info->DspVer[0], snprintf(info->fw_version, sizeof(info->fw_version), "%d.%d.%d.%d",
ft_info->DspVer[1], ft_info->DspVer[2], ft_info->DspVer[3]); 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) static u32 ft1000_get_link(struct net_device *dev)

Просмотреть файл

@ -46,9 +46,9 @@
static void cvm_oct_get_drvinfo(struct net_device *dev, static void cvm_oct_get_drvinfo(struct net_device *dev,
struct ethtool_drvinfo *info) struct ethtool_drvinfo *info)
{ {
strcpy(info->driver, "cavium-ethernet"); strlcpy(info->driver, "cavium-ethernet", sizeof(info->driver));
strcpy(info->version, OCTEON_ETHERNET_VERSION); strlcpy(info->version, OCTEON_ETHERNET_VERSION, sizeof(info->version));
strcpy(info->bus_info, "Builtin"); strlcpy(info->bus_info, "Builtin", sizeof(info->bus_info));
} }
static int cvm_oct_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) static int cvm_oct_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)

Просмотреть файл

@ -34,9 +34,9 @@ static void rtl819x_ethtool_get_drvinfo(struct net_device *dev,
{ {
struct r8192_priv *priv = rtllib_priv(dev); struct r8192_priv *priv = rtllib_priv(dev);
strcpy(info->driver, DRV_NAME); strlcpy(info->driver, DRV_NAME, sizeof(info->driver));
strcpy(info->version, DRV_VERSION); strlcpy(info->version, DRV_VERSION, sizeof(info->version));
strcpy(info->bus_info, pci_name(priv->pdev)); strlcpy(info->bus_info, pci_name(priv->pdev), sizeof(info->bus_info));
} }
static u32 rtl819x_ethtool_get_link(struct net_device *dev) static u32 rtl819x_ethtool_get_link(struct net_device *dev)

Просмотреть файл

@ -457,17 +457,17 @@ int wl_close( struct net_device *dev )
static void wl_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info) static void wl_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info)
{ {
strncpy(info->driver, DRIVER_NAME, sizeof(info->driver) - 1); strlcpy(info->driver, DRIVER_NAME, sizeof(info->driver));
strncpy(info->version, DRV_VERSION_STR, sizeof(info->version) - 1); strlcpy(info->version, DRV_VERSION_STR, sizeof(info->version));
// strncpy(info.fw_version, priv->fw_name, // strlcpy(info.fw_version, priv->fw_name,
// sizeof(info.fw_version) - 1); // sizeof(info.fw_version));
if (dev->dev.parent) { if (dev->dev.parent) {
dev_set_name(dev->dev.parent, "%s", info->bus_info); dev_set_name(dev->dev.parent, "%s", info->bus_info);
//strncpy(info->bus_info, dev->dev.parent->bus_id, //strlcpy(info->bus_info, dev->dev.parent->bus_id,
// sizeof(info->bus_info) - 1); // sizeof(info->bus_info));
} else { } else {
snprintf(info->bus_info, sizeof(info->bus_info) - 1, snprintf(info->bus_info, sizeof(info->bus_info),
"PCMCIA FIXME"); "PCMCIA FIXME");
// "PCMCIA 0x%lx", priv->hw.iobase); // "PCMCIA 0x%lx", priv->hw.iobase);
} }

Просмотреть файл

@ -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) 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->driver, "g_ether", sizeof(p->driver));
strlcpy(p->version, UETH__VERSION, sizeof p->version); strlcpy(p->version, UETH__VERSION, sizeof(p->version));
strlcpy(p->fw_version, dev->gadget->name, sizeof p->fw_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->bus_info, dev_name(&dev->gadget->dev), sizeof(p->bus_info));
} }
/* REVISIT can also support: /* REVISIT can also support:

Просмотреть файл

@ -640,9 +640,9 @@ static int vlan_ethtool_get_settings(struct net_device *dev,
static void vlan_ethtool_get_drvinfo(struct net_device *dev, static void vlan_ethtool_get_drvinfo(struct net_device *dev,
struct ethtool_drvinfo *info) struct ethtool_drvinfo *info)
{ {
strcpy(info->driver, vlan_fullname); strlcpy(info->driver, vlan_fullname, sizeof(info->driver));
strcpy(info->version, vlan_version); strlcpy(info->version, vlan_version, sizeof(info->version));
strcpy(info->fw_version, "N/A"); 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) static struct rtnl_link_stats64 *vlan_dev_get_stats64(struct net_device *dev, struct rtnl_link_stats64 *stats)

Просмотреть файл

@ -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, static void batadv_get_drvinfo(struct net_device *dev,
struct ethtool_drvinfo *info) struct ethtool_drvinfo *info)
{ {
strcpy(info->driver, "B.A.T.M.A.N. advanced"); strlcpy(info->driver, "B.A.T.M.A.N. advanced", sizeof(info->driver));
strcpy(info->version, BATADV_SOURCE_VERSION); strlcpy(info->version, BATADV_SOURCE_VERSION, sizeof(info->version));
strcpy(info->fw_version, "N/A"); strlcpy(info->fw_version, "N/A", sizeof(info->fw_version));
strcpy(info->bus_info, "batman"); strlcpy(info->bus_info, "batman", sizeof(info->bus_info));
} }
static u32 batadv_get_msglevel(struct net_device *dev) static u32 batadv_get_msglevel(struct net_device *dev)

Просмотреть файл

@ -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) static void br_getinfo(struct net_device *dev, struct ethtool_drvinfo *info)
{ {
strcpy(info->driver, "bridge"); strlcpy(info->driver, "bridge", sizeof(info->driver));
strcpy(info->version, BR_VERSION); strlcpy(info->version, BR_VERSION, sizeof(info->version));
strcpy(info->fw_version, "N/A"); strlcpy(info->fw_version, "N/A", sizeof(info->fw_version));
strcpy(info->bus_info, "N/A"); strlcpy(info->bus_info, "N/A", sizeof(info->bus_info));
} }
static netdev_features_t br_fix_features(struct net_device *dev, static netdev_features_t br_fix_features(struct net_device *dev,

Просмотреть файл

@ -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, static void dsa_slave_get_drvinfo(struct net_device *dev,
struct ethtool_drvinfo *drvinfo) struct ethtool_drvinfo *drvinfo)
{ {
strncpy(drvinfo->driver, "dsa", 32); strlcpy(drvinfo->driver, "dsa", sizeof(drvinfo->driver));
strncpy(drvinfo->version, dsa_driver_version, 32); strlcpy(drvinfo->version, dsa_driver_version, sizeof(drvinfo->version));
strncpy(drvinfo->fw_version, "N/A", 32); strlcpy(drvinfo->fw_version, "N/A", sizeof(drvinfo->fw_version));
strncpy(drvinfo->bus_info, "platform", 32); strlcpy(drvinfo->bus_info, "platform", sizeof(drvinfo->bus_info));
} }
static int dsa_slave_nway_reset(struct net_device *dev) static int dsa_slave_nway_reset(struct net_device *dev)

Просмотреть файл

@ -97,7 +97,7 @@ static int internal_dev_stop(struct net_device *netdev)
static void internal_dev_getinfo(struct net_device *netdev, static void internal_dev_getinfo(struct net_device *netdev,
struct ethtool_drvinfo *info) struct ethtool_drvinfo *info)
{ {
strcpy(info->driver, "openvswitch"); strlcpy(info->driver, "openvswitch", sizeof(info->driver));
} }
static const struct ethtool_ops internal_dev_ethtool_ops = { static const struct ethtool_ops internal_dev_ethtool_ops = {

Просмотреть файл

@ -15,10 +15,10 @@ static void cfg80211_get_drvinfo(struct net_device *dev,
strlcpy(info->version, init_utsname()->release, sizeof(info->version)); strlcpy(info->version, init_utsname()->release, sizeof(info->version));
if (wdev->wiphy->fw_version[0]) 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)); sizeof(info->fw_version));
else 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)), strlcpy(info->bus_info, dev_name(wiphy_dev(wdev->wiphy)),
sizeof(info->bus_info)); sizeof(info->bus_info));