* [patch net-next] ethtool: fix drvinfo strings set in drivers
@ 2013-01-05 19:48 Jiri Pirko
2013-01-05 20:23 ` Flavio Leitner
0 siblings, 1 reply; 3+ messages in thread
From: Jiri Pirko @ 2013-01-05 19:48 UTC (permalink / raw)
To: netdev
Cc: davem, edumazet, bhutchings, shemminger, fbl, sathya.perla,
subbu.seetharaman, ajit.khaparde, roland, sean.hefty,
hal.rosenstock
Use strlcpy where possible to ensure the string is \0 terminated.
Use always sizeof(string) instead of 32 and custom defines.
Also use snprintf instead of strcpy in nes_nic.
Also do not do unnecessary init of drvinfo in spider_net_ethtool.
Signed-off-by: Jiri Pirko <jiri@resnulli.us>
---
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/ethernet/broadcom/bcm63xx_enet.c | 9 +++++----
drivers/net/ethernet/emulex/benet/be_ethtool.c | 12 ++++++------
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/tehuti/tehuti.c | 8 ++++----
drivers/net/ethernet/toshiba/spider_net_ethtool.c | 12 +++++++-----
drivers/net/macvlan.c | 4 ++--
net/dsa/slave.c | 8 ++++----
12 files changed, 50 insertions(+), 45 deletions(-)
diff --git a/drivers/infiniband/hw/nes/nes_nic.c b/drivers/infiniband/hw/nes/nes_nic.c
index 9542e16..177cf76 100644
--- a/drivers/infiniband/hw/nes/nes_nic.c
+++ b/drivers/infiniband/hw/nes/nes_nic.c
@@ -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;
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_ethtool.c b/drivers/infiniband/ulp/ipoib/ipoib_ethtool.c
index 29bc7b5..ca13133 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_ethtool.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_ethtool.c
@@ -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,
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index c495298..564cf42 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -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 = {
diff --git a/drivers/net/ethernet/broadcom/bcm63xx_enet.c b/drivers/net/ethernet/broadcom/bcm63xx_enet.c
index 39387d6..d8a1510 100644
--- a/drivers/net/ethernet/broadcom/bcm63xx_enet.c
+++ b/drivers/net/ethernet/broadcom/bcm63xx_enet.c
@@ -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;
}
diff --git a/drivers/net/ethernet/emulex/benet/be_ethtool.c b/drivers/net/ethernet/emulex/benet/be_ethtool.c
index 00454a1..76b302f 100644
--- a/drivers/net/ethernet/emulex/benet/be_ethtool.c
+++ b/drivers/net/ethernet/emulex/benet/be_ethtool.c
@@ -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));
diff --git a/drivers/net/ethernet/freescale/gianfar.h b/drivers/net/ethernet/freescale/gianfar.h
index 22eabc1..1b6a67c 100644
--- a/drivers/net/ethernet/freescale/gianfar.h
+++ b/drivers/net/ethernet/freescale/gianfar.h
@@ -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];
diff --git a/drivers/net/ethernet/freescale/gianfar_ethtool.c b/drivers/net/ethernet/freescale/gianfar_ethtool.c
index ab6762c..d0fe53c 100644
--- a/drivers/net/ethernet/freescale/gianfar_ethtool.c
+++ b/drivers/net/ethernet/freescale/gianfar_ethtool.c
@@ -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;
}
diff --git a/drivers/net/ethernet/freescale/ucc_geth_ethtool.c b/drivers/net/ethernet/freescale/ucc_geth_ethtool.c
index 37b0353..1ebf712 100644
--- a/drivers/net/ethernet/freescale/ucc_geth_ethtool.c
+++ b/drivers/net/ethernet/freescale/ucc_geth_ethtool.c
@@ -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);
}
diff --git a/drivers/net/ethernet/tehuti/tehuti.c b/drivers/net/ethernet/tehuti/tehuti.c
index 1e4d743..e15cc71 100644
--- a/drivers/net/ethernet/tehuti/tehuti.c
+++ b/drivers/net/ethernet/tehuti/tehuti.c
@@ -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);
diff --git a/drivers/net/ethernet/toshiba/spider_net_ethtool.c b/drivers/net/ethernet/toshiba/spider_net_ethtool.c
index 9c288cd..ffe5193 100644
--- a/drivers/net/ethernet/toshiba/spider_net_ethtool.c
+++ b/drivers/net/ethernet/toshiba/spider_net_ethtool.c
@@ -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
diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c
index 0ae4518..1047e58 100644
--- a/drivers/net/macvlan.c
+++ b/drivers/net/macvlan.c
@@ -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,
diff --git a/net/dsa/slave.c b/net/dsa/slave.c
index e32083d..f795b0c 100644
--- a/net/dsa/slave.c
+++ b/net/dsa/slave.c
@@ -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)
--
1.8.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [patch net-next] ethtool: fix drvinfo strings set in drivers
2013-01-05 19:48 [patch net-next] ethtool: fix drvinfo strings set in drivers Jiri Pirko
@ 2013-01-05 20:23 ` Flavio Leitner
2013-01-05 20:40 ` Jiri Pirko
0 siblings, 1 reply; 3+ messages in thread
From: Flavio Leitner @ 2013-01-05 20:23 UTC (permalink / raw)
To: Jiri Pirko
Cc: netdev, davem, edumazet, bhutchings, shemminger, sathya.perla,
subbu.seetharaman, ajit.khaparde, roland, sean.hefty,
hal.rosenstock
On Sat, Jan 05, 2013 at 08:48:56PM +0100, Jiri Pirko wrote:
> Use strlcpy where possible to ensure the string is \0 terminated.
> Use always sizeof(string) instead of 32 and custom defines.
> Also use snprintf instead of strcpy in nes_nic.
> Also do not do unnecessary init of drvinfo in spider_net_ethtool.
>
Looks good. You can add some more fixes to your patch
BTW, I was using ethtool defines, but I think it's cleaner
to use sizeof() instead.
fbl
diff --git a/drivers/net/cris/eth_v10.c b/drivers/net/cris/eth_v10.c
index 021d69c..29e272c 100644
--- a/drivers/net/cris/eth_v10.c
+++ b/drivers/net/cris/eth_v10.c
@@ -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)
diff --git a/drivers/net/ethernet/3com/3c501.c b/drivers/net/ethernet/3com/3c501.c
index 2038eaa..c6dfbb6 100644
--- a/drivers/net/ethernet/3com/3c501.c
+++ b/drivers/net/ethernet/3com/3c501.c
@@ -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, ETHTOOL_BUSINFO_LEN, "ISA 0x%lx",
+ dev->base_addr);
}
static u32 netdev_get_msglevel(struct net_device *dev)
diff --git a/drivers/net/ethernet/3com/3c509.c b/drivers/net/ethernet/3com/3c509.c
index 633c709..f36ff99 100644
--- a/drivers/net/ethernet/3com/3c509.c
+++ b/drivers/net/ethernet/3com/3c509.c
@@ -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)
diff --git a/drivers/net/ethernet/3com/3c515.c b/drivers/net/ethernet/3com/3c515.c
index 59e1e00..9e9fef3 100644
--- a/drivers/net/ethernet/3com/3c515.c
+++ b/drivers/net/ethernet/3com/3c515.c
@@ -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, ETHTOOL_BUSINFO_LEN, "ISA 0x%lx",
+ dev->base_addr);
}
static u32 netdev_get_msglevel(struct net_device *dev)
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [patch net-next] ethtool: fix drvinfo strings set in drivers
2013-01-05 20:23 ` Flavio Leitner
@ 2013-01-05 20:40 ` Jiri Pirko
0 siblings, 0 replies; 3+ messages in thread
From: Jiri Pirko @ 2013-01-05 20:40 UTC (permalink / raw)
To: netdev, davem, edumazet, bhutchings, shemminger, sathya.perla,
subbu.seetharaman, ajit.khaparde, roland, sean.hefty,
hal.rosenstock
Sat, Jan 05, 2013 at 09:23:57PM CET, fbl@redhat.com wrote:
>On Sat, Jan 05, 2013 at 08:48:56PM +0100, Jiri Pirko wrote:
>> Use strlcpy where possible to ensure the string is \0 terminated.
>> Use always sizeof(string) instead of 32 and custom defines.
>> Also use snprintf instead of strcpy in nes_nic.
>> Also do not do unnecessary init of drvinfo in spider_net_ethtool.
>>
>
>Looks good. You can add some more fixes to your patch
>BTW, I was using ethtool defines, but I think it's cleaner
>to use sizeof() instead.
Okay, I will add these 4.
>
>fbl
>
>diff --git a/drivers/net/cris/eth_v10.c b/drivers/net/cris/eth_v10.c
>index 021d69c..29e272c 100644
>--- a/drivers/net/cris/eth_v10.c
>+++ b/drivers/net/cris/eth_v10.c
>@@ -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)
>diff --git a/drivers/net/ethernet/3com/3c501.c b/drivers/net/ethernet/3com/3c501.c
>index 2038eaa..c6dfbb6 100644
>--- a/drivers/net/ethernet/3com/3c501.c
>+++ b/drivers/net/ethernet/3com/3c501.c
>@@ -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, ETHTOOL_BUSINFO_LEN, "ISA 0x%lx",
>+ dev->base_addr);
> }
>
> static u32 netdev_get_msglevel(struct net_device *dev)
>diff --git a/drivers/net/ethernet/3com/3c509.c b/drivers/net/ethernet/3com/3c509.c
>index 633c709..f36ff99 100644
>--- a/drivers/net/ethernet/3com/3c509.c
>+++ b/drivers/net/ethernet/3com/3c509.c
>@@ -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)
>diff --git a/drivers/net/ethernet/3com/3c515.c b/drivers/net/ethernet/3com/3c515.c
>index 59e1e00..9e9fef3 100644
>--- a/drivers/net/ethernet/3com/3c515.c
>+++ b/drivers/net/ethernet/3com/3c515.c
>@@ -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, ETHTOOL_BUSINFO_LEN, "ISA 0x%lx",
>+ dev->base_addr);
> }
>
> static u32 netdev_get_msglevel(struct net_device *dev)
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-01-05 20:40 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-05 19:48 [patch net-next] ethtool: fix drvinfo strings set in drivers Jiri Pirko
2013-01-05 20:23 ` Flavio Leitner
2013-01-05 20:40 ` Jiri Pirko
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).