Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 68aad78c authored by Rick Jones's avatar Rick Jones Committed by David S. Miller
Browse files

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: default avatarRick Jones <rick.jones2@hp.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 34d2d89f
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -468,9 +468,10 @@ static void tc589_reset(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, "PCMCIA 0x%lx", dev->base_addr);
	strlcpy(info->driver, DRV_NAME, sizeof(info->driver));
	strlcpy(info->version, DRV_VERSION, sizeof(info->version));
	snprintf(info->bus_info, sizeof(info->bus_info),
		"PCMCIA 0x%lx", dev->base_addr);
}

static const struct ethtool_ops netdev_ethtool_ops = {
+7 −5
Original line number Diff line number Diff line
@@ -2929,15 +2929,17 @@ static void vortex_get_drvinfo(struct net_device *dev,
{
	struct vortex_private *vp = netdev_priv(dev);

	strcpy(info->driver, DRV_NAME);
	strlcpy(info->driver, DRV_NAME, sizeof(info->driver));
	if (VORTEX_PCI(vp)) {
		strcpy(info->bus_info, pci_name(VORTEX_PCI(vp)));
		strlcpy(info->bus_info, pci_name(VORTEX_PCI(vp)),
			sizeof(info->bus_info));
	} else {
		if (VORTEX_EISA(vp))
			strcpy(info->bus_info, dev_name(vp->gendev));
			strlcpy(info->bus_info, dev_name(vp->gendev),
				sizeof(info->bus_info));
		else
			sprintf(info->bus_info, "EISA 0x%lx %d",
					dev->base_addr, dev->irq);
			snprintf(info->bus_info, sizeof(info->bus_info),
				"EISA 0x%lx %d", dev->base_addr, dev->irq);
	}
}

+9 −7
Original line number Diff line number Diff line
@@ -988,21 +988,23 @@ typhoon_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info)

	smp_rmb();
	if(tp->card_state == Sleeping) {
		strcpy(info->fw_version, "Sleep image");
		strlcpy(info->fw_version, "Sleep image",
			sizeof(info->fw_version));
	} else {
		INIT_COMMAND_WITH_RESPONSE(&xp_cmd, TYPHOON_CMD_READ_VERSIONS);
		if(typhoon_issue_command(tp, 1, &xp_cmd, 3, xp_resp) < 0) {
			strcpy(info->fw_version, "Unknown runtime");
			strlcpy(info->fw_version, "Unknown runtime",
				sizeof(info->fw_version));
		} else {
			u32 sleep_ver = le32_to_cpu(xp_resp[0].parm2);
			snprintf(info->fw_version, 32, "%02x.%03x.%03x",
				 sleep_ver >> 24, (sleep_ver >> 12) & 0xfff,
				 sleep_ver & 0xfff);
			snprintf(info->fw_version, sizeof(info->fw_version),
				"%02x.%03x.%03x", sleep_ver >> 24,
				(sleep_ver >> 12) & 0xfff, sleep_ver & 0xfff);
		}
	}

	strcpy(info->driver, KBUILD_MODNAME);
	strcpy(info->bus_info, pci_name(pci_dev));
	strlcpy(info->driver, KBUILD_MODNAME, sizeof(info->driver));
	strlcpy(info->bus_info, pci_name(pci_dev), sizeof(info->bus_info));
}

static int
+3 −3
Original line number Diff line number Diff line
@@ -639,9 +639,9 @@ static void ne2k_pci_get_drvinfo(struct net_device *dev,
	struct ei_device *ei = netdev_priv(dev);
	struct pci_dev *pci_dev = (struct pci_dev *) ei->priv;

	strcpy(info->driver, DRV_NAME);
	strcpy(info->version, DRV_VERSION);
	strcpy(info->bus_info, pci_name(pci_dev));
	strlcpy(info->driver, DRV_NAME, sizeof(info->driver));
	strlcpy(info->version, DRV_VERSION, sizeof(info->version));
	strlcpy(info->bus_info, pci_name(pci_dev), sizeof(info->bus_info));
}

static const struct ethtool_ops ne2k_pci_ethtool_ops = {
+3 −3
Original line number Diff line number Diff line
@@ -1842,9 +1842,9 @@ static int check_if_running(struct net_device *dev)
static void get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info)
{
	struct netdev_private *np = netdev_priv(dev);
	strcpy(info->driver, DRV_NAME);
	strcpy(info->version, DRV_VERSION);
	strcpy(info->bus_info, pci_name(np->pci_dev));
	strlcpy(info->driver, DRV_NAME, sizeof(info->driver));
	strlcpy(info->version, DRV_VERSION, sizeof(info->version));
	strlcpy(info->bus_info, pci_name(np->pci_dev), sizeof(info->bus_info));
}

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