* [PATCH] usbnet: sanitise overlong driver information strings
@ 2012-06-14 11:18 Phil Sutter
2012-06-14 19:08 ` Ben Hutchings
2012-06-17 23:20 ` David Miller
0 siblings, 2 replies; 3+ messages in thread
From: Phil Sutter @ 2012-06-14 11:18 UTC (permalink / raw)
To: netdev; +Cc: davem
As seen on smsc75xx, driver_info->description being longer than 32
characters messes up 'ethtool -i' output.
Signed-off-by: Phil Sutter <phil.sutter@viprinet.com>
---
drivers/net/usb/usbnet.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c
index 9f58330..d4f7256 100644
--- a/drivers/net/usb/usbnet.c
+++ b/drivers/net/usb/usbnet.c
@@ -876,9 +876,9 @@ void usbnet_get_drvinfo (struct net_device *net, struct ethtool_drvinfo *info)
{
struct usbnet *dev = netdev_priv(net);
- strncpy (info->driver, dev->driver_name, sizeof info->driver);
- strncpy (info->version, DRIVER_VERSION, sizeof info->version);
- strncpy (info->fw_version, dev->driver_info->description,
+ strlcpy (info->driver, dev->driver_name, sizeof info->driver);
+ strlcpy (info->version, DRIVER_VERSION, sizeof info->version);
+ strlcpy (info->fw_version, dev->driver_info->description,
sizeof info->fw_version);
usb_make_path (dev->udev, info->bus_info, sizeof info->bus_info);
}
--
1.7.3.4
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] usbnet: sanitise overlong driver information strings
2012-06-14 11:18 [PATCH] usbnet: sanitise overlong driver information strings Phil Sutter
@ 2012-06-14 19:08 ` Ben Hutchings
2012-06-17 23:20 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: Ben Hutchings @ 2012-06-14 19:08 UTC (permalink / raw)
To: Phil Sutter; +Cc: netdev, davem
On Thu, 2012-06-14 at 13:18 +0200, Phil Sutter wrote:
> As seen on smsc75xx, driver_info->description being longer than 32
> characters messes up 'ethtool -i' output.
I should make ethtool tolerate that, but yes these are supposed to be
null-terminated strings.
Ben.
> Signed-off-by: Phil Sutter <phil.sutter@viprinet.com>
> ---
> drivers/net/usb/usbnet.c | 6 +++---
> 1 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c
> index 9f58330..d4f7256 100644
> --- a/drivers/net/usb/usbnet.c
> +++ b/drivers/net/usb/usbnet.c
> @@ -876,9 +876,9 @@ void usbnet_get_drvinfo (struct net_device *net, struct ethtool_drvinfo *info)
> {
> struct usbnet *dev = netdev_priv(net);
>
> - strncpy (info->driver, dev->driver_name, sizeof info->driver);
> - strncpy (info->version, DRIVER_VERSION, sizeof info->version);
> - strncpy (info->fw_version, dev->driver_info->description,
> + strlcpy (info->driver, dev->driver_name, sizeof info->driver);
> + strlcpy (info->version, DRIVER_VERSION, sizeof info->version);
> + strlcpy (info->fw_version, dev->driver_info->description,
> sizeof info->fw_version);
> usb_make_path (dev->udev, info->bus_info, sizeof info->bus_info);
> }
--
Ben Hutchings, Staff Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] usbnet: sanitise overlong driver information strings
2012-06-14 11:18 [PATCH] usbnet: sanitise overlong driver information strings Phil Sutter
2012-06-14 19:08 ` Ben Hutchings
@ 2012-06-17 23:20 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2012-06-17 23:20 UTC (permalink / raw)
To: phil.sutter; +Cc: netdev
From: Phil Sutter <phil.sutter@viprinet.com>
Date: Thu, 14 Jun 2012 13:18:42 +0200
> As seen on smsc75xx, driver_info->description being longer than 32
> characters messes up 'ethtool -i' output.
>
> Signed-off-by: Phil Sutter <phil.sutter@viprinet.com>
Applied.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-06-17 23:20 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-06-14 11:18 [PATCH] usbnet: sanitise overlong driver information strings Phil Sutter
2012-06-14 19:08 ` Ben Hutchings
2012-06-17 23:20 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox