Skip to content

Commit 68aad78

Browse files
Rick Jonesdavem330
authored andcommitted
sweep the floors and convert some .get_drvinfo routines to strlcpy
Per the mention made by Ben Hutchings that strlcpy is now the preferred string copy routine for a .get_drvinfo routine, do a bit of floor sweeping and convert some of the as-yet unconverted ethernet drivers to it. Signed-off-by: Rick Jones <rick.jones2@hp.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 34d2d89 commit 68aad78

File tree

38 files changed

+166
-136
lines changed

38 files changed

+166
-136
lines changed

drivers/net/ethernet/3com/3c589_cs.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -468,9 +468,10 @@ static void tc589_reset(struct net_device *dev)
468468
static void netdev_get_drvinfo(struct net_device *dev,
469469
struct ethtool_drvinfo *info)
470470
{
471-
strcpy(info->driver, DRV_NAME);
472-
strcpy(info->version, DRV_VERSION);
473-
sprintf(info->bus_info, "PCMCIA 0x%lx", dev->base_addr);
471+
strlcpy(info->driver, DRV_NAME, sizeof(info->driver));
472+
strlcpy(info->version, DRV_VERSION, sizeof(info->version));
473+
snprintf(info->bus_info, sizeof(info->bus_info),
474+
"PCMCIA 0x%lx", dev->base_addr);
474475
}
475476

476477
static const struct ethtool_ops netdev_ethtool_ops = {

drivers/net/ethernet/3com/3c59x.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2929,15 +2929,17 @@ static void vortex_get_drvinfo(struct net_device *dev,
29292929
{
29302930
struct vortex_private *vp = netdev_priv(dev);
29312931

2932-
strcpy(info->driver, DRV_NAME);
2932+
strlcpy(info->driver, DRV_NAME, sizeof(info->driver));
29332933
if (VORTEX_PCI(vp)) {
2934-
strcpy(info->bus_info, pci_name(VORTEX_PCI(vp)));
2934+
strlcpy(info->bus_info, pci_name(VORTEX_PCI(vp)),
2935+
sizeof(info->bus_info));
29352936
} else {
29362937
if (VORTEX_EISA(vp))
2937-
strcpy(info->bus_info, dev_name(vp->gendev));
2938+
strlcpy(info->bus_info, dev_name(vp->gendev),
2939+
sizeof(info->bus_info));
29382940
else
2939-
sprintf(info->bus_info, "EISA 0x%lx %d",
2940-
dev->base_addr, dev->irq);
2941+
snprintf(info->bus_info, sizeof(info->bus_info),
2942+
"EISA 0x%lx %d", dev->base_addr, dev->irq);
29412943
}
29422944
}
29432945

drivers/net/ethernet/3com/typhoon.c

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -988,21 +988,23 @@ typhoon_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info)
988988

989989
smp_rmb();
990990
if(tp->card_state == Sleeping) {
991-
strcpy(info->fw_version, "Sleep image");
991+
strlcpy(info->fw_version, "Sleep image",
992+
sizeof(info->fw_version));
992993
} else {
993994
INIT_COMMAND_WITH_RESPONSE(&xp_cmd, TYPHOON_CMD_READ_VERSIONS);
994995
if(typhoon_issue_command(tp, 1, &xp_cmd, 3, xp_resp) < 0) {
995-
strcpy(info->fw_version, "Unknown runtime");
996+
strlcpy(info->fw_version, "Unknown runtime",
997+
sizeof(info->fw_version));
996998
} else {
997999
u32 sleep_ver = le32_to_cpu(xp_resp[0].parm2);
998-
snprintf(info->fw_version, 32, "%02x.%03x.%03x",
999-
sleep_ver >> 24, (sleep_ver >> 12) & 0xfff,
1000-
sleep_ver & 0xfff);
1000+
snprintf(info->fw_version, sizeof(info->fw_version),
1001+
"%02x.%03x.%03x", sleep_ver >> 24,
1002+
(sleep_ver >> 12) & 0xfff, sleep_ver & 0xfff);
10011003
}
10021004
}
10031005

1004-
strcpy(info->driver, KBUILD_MODNAME);
1005-
strcpy(info->bus_info, pci_name(pci_dev));
1006+
strlcpy(info->driver, KBUILD_MODNAME, sizeof(info->driver));
1007+
strlcpy(info->bus_info, pci_name(pci_dev), sizeof(info->bus_info));
10061008
}
10071009

10081010
static int

drivers/net/ethernet/8390/ne2k-pci.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -639,9 +639,9 @@ static void ne2k_pci_get_drvinfo(struct net_device *dev,
639639
struct ei_device *ei = netdev_priv(dev);
640640
struct pci_dev *pci_dev = (struct pci_dev *) ei->priv;
641641

642-
strcpy(info->driver, DRV_NAME);
643-
strcpy(info->version, DRV_VERSION);
644-
strcpy(info->bus_info, pci_name(pci_dev));
642+
strlcpy(info->driver, DRV_NAME, sizeof(info->driver));
643+
strlcpy(info->version, DRV_VERSION, sizeof(info->version));
644+
strlcpy(info->bus_info, pci_name(pci_dev), sizeof(info->bus_info));
645645
}
646646

647647
static const struct ethtool_ops ne2k_pci_ethtool_ops = {

drivers/net/ethernet/adaptec/starfire.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1842,9 +1842,9 @@ static int check_if_running(struct net_device *dev)
18421842
static void get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info)
18431843
{
18441844
struct netdev_private *np = netdev_priv(dev);
1845-
strcpy(info->driver, DRV_NAME);
1846-
strcpy(info->version, DRV_VERSION);
1847-
strcpy(info->bus_info, pci_name(np->pci_dev));
1845+
strlcpy(info->driver, DRV_NAME, sizeof(info->driver));
1846+
strlcpy(info->version, DRV_VERSION, sizeof(info->version));
1847+
strlcpy(info->bus_info, pci_name(np->pci_dev), sizeof(info->bus_info));
18481848
}
18491849

18501850
static int get_settings(struct net_device *dev, struct ethtool_cmd *ecmd)

drivers/net/ethernet/atheros/atl1e/atl1e_ethtool.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -310,10 +310,12 @@ static void atl1e_get_drvinfo(struct net_device *netdev,
310310
{
311311
struct atl1e_adapter *adapter = netdev_priv(netdev);
312312

313-
strncpy(drvinfo->driver, atl1e_driver_name, 32);
314-
strncpy(drvinfo->version, atl1e_driver_version, 32);
315-
strncpy(drvinfo->fw_version, "L1e", 32);
316-
strncpy(drvinfo->bus_info, pci_name(adapter->pdev), 32);
313+
strlcpy(drvinfo->driver, atl1e_driver_name, sizeof(drvinfo->driver));
314+
strlcpy(drvinfo->version, atl1e_driver_version,
315+
sizeof(drvinfo->version));
316+
strlcpy(drvinfo->fw_version, "L1e", sizeof(drvinfo->fw_version));
317+
strlcpy(drvinfo->bus_info, pci_name(adapter->pdev),
318+
sizeof(drvinfo->bus_info));
317319
drvinfo->n_stats = 0;
318320
drvinfo->testinfo_len = 0;
319321
drvinfo->regdump_len = atl1e_get_regs_len(netdev);

drivers/net/ethernet/atheros/atlx/atl2.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2049,10 +2049,12 @@ static void atl2_get_drvinfo(struct net_device *netdev,
20492049
{
20502050
struct atl2_adapter *adapter = netdev_priv(netdev);
20512051

2052-
strncpy(drvinfo->driver, atl2_driver_name, 32);
2053-
strncpy(drvinfo->version, atl2_driver_version, 32);
2054-
strncpy(drvinfo->fw_version, "L2", 32);
2055-
strncpy(drvinfo->bus_info, pci_name(adapter->pdev), 32);
2052+
strlcpy(drvinfo->driver, atl2_driver_name, sizeof(drvinfo->driver));
2053+
strlcpy(drvinfo->version, atl2_driver_version,
2054+
sizeof(drvinfo->version));
2055+
strlcpy(drvinfo->fw_version, "L2", sizeof(drvinfo->fw_version));
2056+
strlcpy(drvinfo->bus_info, pci_name(adapter->pdev),
2057+
sizeof(drvinfo->bus_info));
20562058
drvinfo->n_stats = 0;
20572059
drvinfo->testinfo_len = 0;
20582060
drvinfo->regdump_len = atl2_get_regs_len(netdev);

drivers/net/ethernet/broadcom/bnx2.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6873,10 +6873,10 @@ bnx2_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info)
68736873
{
68746874
struct bnx2 *bp = netdev_priv(dev);
68756875

6876-
strcpy(info->driver, DRV_MODULE_NAME);
6877-
strcpy(info->version, DRV_MODULE_VERSION);
6878-
strcpy(info->bus_info, pci_name(bp->pdev));
6879-
strcpy(info->fw_version, bp->fw_version);
6876+
strlcpy(info->driver, DRV_MODULE_NAME, sizeof(info->driver));
6877+
strlcpy(info->version, DRV_MODULE_VERSION, sizeof(info->version));
6878+
strlcpy(info->bus_info, pci_name(bp->pdev), sizeof(info->bus_info));
6879+
strlcpy(info->fw_version, bp->fw_version, sizeof(info->fw_version));
68806880
}
68816881

68826882
#define BNX2_REGDUMP_LEN (32 * 1024)

drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -761,8 +761,8 @@ static void bnx2x_get_drvinfo(struct net_device *dev,
761761
struct bnx2x *bp = netdev_priv(dev);
762762
u8 phy_fw_ver[PHY_FW_VER_LEN];
763763

764-
strcpy(info->driver, DRV_MODULE_NAME);
765-
strcpy(info->version, DRV_MODULE_VERSION);
764+
strlcpy(info->driver, DRV_MODULE_NAME, sizeof(info->driver));
765+
strlcpy(info->version, DRV_MODULE_VERSION, sizeof(info->version));
766766

767767
phy_fw_ver[0] = '\0';
768768
if (bp->port.pmf) {
@@ -773,14 +773,14 @@ static void bnx2x_get_drvinfo(struct net_device *dev,
773773
bnx2x_release_phy_lock(bp);
774774
}
775775

776-
strncpy(info->fw_version, bp->fw_ver, 32);
776+
strlcpy(info->fw_version, bp->fw_ver, sizeof(info->fw_version));
777777
snprintf(info->fw_version + strlen(bp->fw_ver), 32 - strlen(bp->fw_ver),
778778
"bc %d.%d.%d%s%s",
779779
(bp->common.bc_ver & 0xff0000) >> 16,
780780
(bp->common.bc_ver & 0xff00) >> 8,
781781
(bp->common.bc_ver & 0xff),
782782
((phy_fw_ver[0] != '\0') ? " phy " : ""), phy_fw_ver);
783-
strcpy(info->bus_info, pci_name(bp->pdev));
783+
strlcpy(info->bus_info, pci_name(bp->pdev), sizeof(info->bus_info));
784784
info->n_stats = BNX2X_NUM_STATS;
785785
info->testinfo_len = BNX2X_NUM_TESTS;
786786
info->eedump_len = bp->common.flash_size;

drivers/net/ethernet/broadcom/tg3.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10428,10 +10428,10 @@ static void tg3_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info
1042810428
{
1042910429
struct tg3 *tp = netdev_priv(dev);
1043010430

10431-
strcpy(info->driver, DRV_MODULE_NAME);
10432-
strcpy(info->version, DRV_MODULE_VERSION);
10433-
strcpy(info->fw_version, tp->fw_ver);
10434-
strcpy(info->bus_info, pci_name(tp->pdev));
10431+
strlcpy(info->driver, DRV_MODULE_NAME, sizeof(info->driver));
10432+
strlcpy(info->version, DRV_MODULE_VERSION, sizeof(info->version));
10433+
strlcpy(info->fw_version, tp->fw_ver, sizeof(info->fw_version));
10434+
strlcpy(info->bus_info, pci_name(tp->pdev), sizeof(info->bus_info));
1043510435
}
1043610436

1043710437
static void tg3_get_wol(struct net_device *dev, struct ethtool_wolinfo *wol)

drivers/net/ethernet/brocade/bna/bnad_ethtool.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -296,21 +296,22 @@ bnad_get_drvinfo(struct net_device *netdev, struct ethtool_drvinfo *drvinfo)
296296
struct bfa_ioc_attr *ioc_attr;
297297
unsigned long flags;
298298

299-
strcpy(drvinfo->driver, BNAD_NAME);
300-
strcpy(drvinfo->version, BNAD_VERSION);
299+
strlcpy(drvinfo->driver, BNAD_NAME, sizeof(drvinfo->driver));
300+
strlcpy(drvinfo->version, BNAD_VERSION, sizeof(drvinfo->version));
301301

302302
ioc_attr = kzalloc(sizeof(*ioc_attr), GFP_KERNEL);
303303
if (ioc_attr) {
304304
spin_lock_irqsave(&bnad->bna_lock, flags);
305305
bfa_nw_ioc_get_attr(&bnad->bna.ioceth.ioc, ioc_attr);
306306
spin_unlock_irqrestore(&bnad->bna_lock, flags);
307307

308-
strncpy(drvinfo->fw_version, ioc_attr->adapter_attr.fw_ver,
309-
sizeof(drvinfo->fw_version) - 1);
308+
strlcpy(drvinfo->fw_version, ioc_attr->adapter_attr.fw_ver,
309+
sizeof(drvinfo->fw_version));
310310
kfree(ioc_attr);
311311
}
312312

313-
strncpy(drvinfo->bus_info, pci_name(bnad->pcidev), ETHTOOL_BUSINFO_LEN);
313+
strlcpy(drvinfo->bus_info, pci_name(bnad->pcidev),
314+
sizeof(drvinfo->bus_info));
314315
}
315316

316317
static void

drivers/net/ethernet/dec/tulip/de2104x.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1598,9 +1598,9 @@ static void de_get_drvinfo (struct net_device *dev,struct ethtool_drvinfo *info)
15981598
{
15991599
struct de_private *de = netdev_priv(dev);
16001600

1601-
strcpy (info->driver, DRV_NAME);
1602-
strcpy (info->version, DRV_VERSION);
1603-
strcpy (info->bus_info, pci_name(de->pdev));
1601+
strlcpy(info->driver, DRV_NAME, sizeof(info->driver));
1602+
strlcpy(info->version, DRV_VERSION, sizeof(info->version));
1603+
strlcpy(info->bus_info, pci_name(de->pdev), sizeof(info->bus_info));
16041604
info->eedump_len = DE_EEPROM_SIZE;
16051605
}
16061606

drivers/net/ethernet/dec/tulip/dmfe.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1085,10 +1085,11 @@ static void dmfe_ethtool_get_drvinfo(struct net_device *dev,
10851085
{
10861086
struct dmfe_board_info *np = netdev_priv(dev);
10871087

1088-
strcpy(info->driver, DRV_NAME);
1089-
strcpy(info->version, DRV_VERSION);
1088+
strlcpy(info->driver, DRV_NAME, sizeof(info->driver));
1089+
strlcpy(info->version, DRV_VERSION, sizeof(info->version));
10901090
if (np->pdev)
1091-
strcpy(info->bus_info, pci_name(np->pdev));
1091+
strlcpy(info->bus_info, pci_name(np->pdev),
1092+
sizeof(info->bus_info));
10921093
else
10931094
sprintf(info->bus_info, "EISA 0x%lx %d",
10941095
dev->base_addr, dev->irq);

drivers/net/ethernet/dec/tulip/tulip_core.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -871,9 +871,9 @@ static struct net_device_stats *tulip_get_stats(struct net_device *dev)
871871
static void tulip_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info)
872872
{
873873
struct tulip_private *np = netdev_priv(dev);
874-
strcpy(info->driver, DRV_NAME);
875-
strcpy(info->version, DRV_VERSION);
876-
strcpy(info->bus_info, pci_name(np->pdev));
874+
strlcpy(info->driver, DRV_NAME, sizeof(info->driver));
875+
strlcpy(info->version, DRV_VERSION, sizeof(info->version));
876+
strlcpy(info->bus_info, pci_name(np->pdev), sizeof(info->bus_info));
877877
}
878878

879879

drivers/net/ethernet/dec/tulip/uli526x.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -960,10 +960,11 @@ static void netdev_get_drvinfo(struct net_device *dev,
960960
{
961961
struct uli526x_board_info *np = netdev_priv(dev);
962962

963-
strcpy(info->driver, DRV_NAME);
964-
strcpy(info->version, DRV_VERSION);
963+
strlcpy(info->driver, DRV_NAME, sizeof(info->driver));
964+
strlcpy(info->version, DRV_VERSION, sizeof(info->version));
965965
if (np->pdev)
966-
strcpy(info->bus_info, pci_name(np->pdev));
966+
strlcpy(info->bus_info, pci_name(np->pdev),
967+
sizeof(info->bus_info));
967968
else
968969
sprintf(info->bus_info, "EISA 0x%lx %d",
969970
dev->base_addr, dev->irq);

drivers/net/ethernet/dec/tulip/winbond-840.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1390,9 +1390,9 @@ static void netdev_get_drvinfo (struct net_device *dev, struct ethtool_drvinfo *
13901390
{
13911391
struct netdev_private *np = netdev_priv(dev);
13921392

1393-
strcpy (info->driver, DRV_NAME);
1394-
strcpy (info->version, DRV_VERSION);
1395-
strcpy (info->bus_info, pci_name(np->pci_dev));
1393+
strlcpy(info->driver, DRV_NAME, sizeof(info->driver));
1394+
strlcpy(info->version, DRV_VERSION, sizeof(info->version));
1395+
strlcpy(info->bus_info, pci_name(np->pci_dev), sizeof(info->bus_info));
13961396
}
13971397

13981398
static int netdev_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)

drivers/net/ethernet/dlink/sundance.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1634,9 +1634,9 @@ static int check_if_running(struct net_device *dev)
16341634
static void get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info)
16351635
{
16361636
struct netdev_private *np = netdev_priv(dev);
1637-
strcpy(info->driver, DRV_NAME);
1638-
strcpy(info->version, DRV_VERSION);
1639-
strcpy(info->bus_info, pci_name(np->pci_dev));
1637+
strlcpy(info->driver, DRV_NAME, sizeof(info->driver));
1638+
strlcpy(info->version, DRV_VERSION, sizeof(info->version));
1639+
strlcpy(info->bus_info, pci_name(np->pci_dev), sizeof(info->bus_info));
16401640
}
16411641

16421642
static int get_settings(struct net_device *dev, struct ethtool_cmd *ecmd)

drivers/net/ethernet/dnet.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -804,9 +804,9 @@ static int dnet_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
804804
static void dnet_get_drvinfo(struct net_device *dev,
805805
struct ethtool_drvinfo *info)
806806
{
807-
strcpy(info->driver, DRV_NAME);
808-
strcpy(info->version, DRV_VERSION);
809-
strcpy(info->bus_info, "0");
807+
strlcpy(info->driver, DRV_NAME, sizeof(info->driver));
808+
strlcpy(info->version, DRV_VERSION, sizeof(info->version));
809+
strlcpy(info->bus_info, "0", sizeof(info->bus_info));
810810
}
811811

812812
static const struct ethtool_ops dnet_ethtool_ops = {

drivers/net/ethernet/emulex/benet/be_ethtool.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,16 +127,17 @@ static void be_get_drvinfo(struct net_device *netdev,
127127
memset(fw_on_flash, 0 , sizeof(fw_on_flash));
128128
be_cmd_get_fw_ver(adapter, adapter->fw_ver, fw_on_flash);
129129

130-
strcpy(drvinfo->driver, DRV_NAME);
131-
strcpy(drvinfo->version, DRV_VER);
130+
strlcpy(drvinfo->driver, DRV_NAME, sizeof(drvinfo->driver));
131+
strlcpy(drvinfo->version, DRV_VER, sizeof(drvinfo->version));
132132
strncpy(drvinfo->fw_version, adapter->fw_ver, FW_VER_LEN);
133133
if (memcmp(adapter->fw_ver, fw_on_flash, FW_VER_LEN) != 0) {
134134
strcat(drvinfo->fw_version, " [");
135135
strcat(drvinfo->fw_version, fw_on_flash);
136136
strcat(drvinfo->fw_version, "]");
137137
}
138138

139-
strcpy(drvinfo->bus_info, pci_name(adapter->pdev));
139+
strlcpy(drvinfo->bus_info, pci_name(adapter->pdev),
140+
sizeof(drvinfo->bus_info));
140141
drvinfo->testinfo_len = 0;
141142
drvinfo->regdump_len = 0;
142143
drvinfo->eedump_len = 0;

drivers/net/ethernet/fealnx.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1818,9 +1818,9 @@ static void netdev_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *i
18181818
{
18191819
struct netdev_private *np = netdev_priv(dev);
18201820

1821-
strcpy(info->driver, DRV_NAME);
1822-
strcpy(info->version, DRV_VERSION);
1823-
strcpy(info->bus_info, pci_name(np->pci_dev));
1821+
strlcpy(info->driver, DRV_NAME, sizeof(info->driver));
1822+
strlcpy(info->version, DRV_VERSION, sizeof(info->version));
1823+
strlcpy(info->bus_info, pci_name(np->pci_dev), sizeof(info->bus_info));
18241824
}
18251825

18261826
static int netdev_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)

drivers/net/ethernet/i825xx/eepro.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1726,9 +1726,10 @@ static int eepro_ethtool_get_settings(struct net_device *dev,
17261726
static void eepro_ethtool_get_drvinfo(struct net_device *dev,
17271727
struct ethtool_drvinfo *drvinfo)
17281728
{
1729-
strcpy(drvinfo->driver, DRV_NAME);
1730-
strcpy(drvinfo->version, DRV_VERSION);
1731-
sprintf(drvinfo->bus_info, "ISA 0x%lx", dev->base_addr);
1729+
strlcpy(drvinfo->driver, DRV_NAME, sizeof(drvinfo->driver));
1730+
strlcpy(drvinfo->version, DRV_VERSION, sizeof(drvinfo->version));
1731+
snprintf(drvinfo->bus_info, sizeof(drvinfo->bus_info),
1732+
"ISA 0x%lx", dev->base_addr);
17321733
}
17331734

17341735
static const struct ethtool_ops eepro_ethtool_ops = {

drivers/net/ethernet/marvell/mv643xx_eth.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1502,10 +1502,11 @@ mv643xx_eth_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
15021502
static void mv643xx_eth_get_drvinfo(struct net_device *dev,
15031503
struct ethtool_drvinfo *drvinfo)
15041504
{
1505-
strncpy(drvinfo->driver, mv643xx_eth_driver_name, 32);
1506-
strncpy(drvinfo->version, mv643xx_eth_driver_version, 32);
1507-
strncpy(drvinfo->fw_version, "N/A", 32);
1508-
strncpy(drvinfo->bus_info, "platform", 32);
1505+
strlcpy(drvinfo->driver, mv643xx_eth_driver_name, sizeof(info->driver));
1506+
strlcpy(drvinfo->version, mv643xx_eth_driver_version,
1507+
sizeof(info->version));
1508+
strlcpy(drvinfo->fw_version, "N/A", sizeof(info->fw_version));
1509+
strlcpy(drvinfo->bus_info, "platform", sizeof(info->bus_info));
15091510
drvinfo->n_stats = ARRAY_SIZE(mv643xx_eth_stats);
15101511
}
15111512

drivers/net/ethernet/marvell/skge.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -394,10 +394,11 @@ static void skge_get_drvinfo(struct net_device *dev,
394394
{
395395
struct skge_port *skge = netdev_priv(dev);
396396

397-
strcpy(info->driver, DRV_NAME);
398-
strcpy(info->version, DRV_VERSION);
399-
strcpy(info->fw_version, "N/A");
400-
strcpy(info->bus_info, pci_name(skge->hw->pdev));
397+
strlcpy(info->driver, DRV_NAME, sizeof(info->driver));
398+
strlcpy(info->version, DRV_VERSION, sizeof(info->version));
399+
strlcpy(info->fw_version, "N/A", sizeof(info->fw_version));
400+
strlcpy(info->bus_info, pci_name(skge->hw->pdev),
401+
sizeof(info->bus_info));
401402
}
402403

403404
static const struct skge_stat {

0 commit comments

Comments
 (0)