From 7826d43f2db45c9305a6e0ba165650e1a203f517 Mon Sep 17 00:00:00 2001 From: Jiri Pirko Date: Sun, 6 Jan 2013 00:44:26 +0000 Subject: 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 Signed-off-by: David S. Miller --- drivers/staging/et131x/et131x.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'drivers/staging/et131x/et131x.c') diff --git a/drivers/staging/et131x/et131x.c b/drivers/staging/et131x/et131x.c index 84bbcd48e264..f15059ca3781 100644 --- a/drivers/staging/et131x/et131x.c +++ b/drivers/staging/et131x/et131x.c @@ -3560,15 +3560,15 @@ static void et131x_get_regs(struct net_device *netdev, regs_buff[num++] = readl(&aregs->rxdma.fbr1_min_des); } -#define ET131X_DRVINFO_LEN 32 /* value from ethtool.h */ static void et131x_get_drvinfo(struct net_device *netdev, struct ethtool_drvinfo *info) { struct et131x_adapter *adapter = netdev_priv(netdev); - strncpy(info->driver, DRIVER_NAME, ET131X_DRVINFO_LEN); - strncpy(info->version, DRIVER_VERSION, ET131X_DRVINFO_LEN); - strncpy(info->bus_info, pci_name(adapter->pdev), ET131X_DRVINFO_LEN); + strlcpy(info->driver, DRIVER_NAME, sizeof(info->driver)); + strlcpy(info->version, DRIVER_VERSION, sizeof(info->version)); + strlcpy(info->bus_info, pci_name(adapter->pdev), + sizeof(info->bus_info)); } static struct ethtool_ops et131x_ethtool_ops = { -- cgit v1.2.3-59-g8ed1b