mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jiri Pirko <jiri@resnulli.us>
To: Michal Privoznik <mprivozn@redhat.com>
Cc: davem@davemloft.net, gregkh@linuxfoundation.org,
	linux-kernel@vger.kernel.org, netdev@vger.kernel.org
Subject: Re: [PATCH] net-sysfs: Report link speed as signed integer
Date: Mon, 2 Jun 2014 16:35:57 +0200	[thread overview]
Message-ID: <20140602143557.GA2925@minipsycho.orion> (raw)
In-Reply-To: <06d53256e3bf2d0deedb16249082200500da3ee6.1401718809.git.mprivozn@redhat.com>

Mon, Jun 02, 2014 at 04:25:15PM CEST, mprivozn@redhat.com wrote:
>The link speed is available at /sys/class/net/$nic/speed.
>However, the speed is printed in unsigned integer format. This
>makes userspace applications read an incorrect value (which
>moreover changes through several architectures) while in fact
>'-1' should be reported.
>
>Before the change:
>  # cat /sys/class/net/eth0/speed
>  4294967295
>
>After the change:
>  # cat /sys/class/net/eth0/speed
>  -1
>
>Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
>---
> net/core/net-sysfs.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
>diff --git a/net/core/net-sysfs.c b/net/core/net-sysfs.c
>index 1cac29e..99afdea 100644
>--- a/net/core/net-sysfs.c
>+++ b/net/core/net-sysfs.c
>@@ -173,7 +173,7 @@ static ssize_t speed_show(struct device *dev,
> 	if (netif_running(netdev)) {
> 		struct ethtool_cmd cmd;
> 		if (!__ethtool_get_settings(netdev, &cmd))
>-			ret = sprintf(buf, fmt_udec, ethtool_cmd_speed(&cmd));
>+			ret = sprintf(buf, fmt_dec, ethtool_cmd_speed(&cmd));

I wonder why this should be signed. What -1 means? What driver reports
this?

> 	}
> 	rtnl_unlock();
> 	return ret;
>-- 
>2.0.0
>

  reply	other threads:[~2014-06-02 14:36 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-02 14:25 Michal Privoznik
2014-06-02 14:35 ` Jiri Pirko [this message]
2014-06-02 14:40   ` Bjørn Mork
2014-06-02 14:43   ` Michal Privoznik
2014-06-02 15:01   ` Veaceslav Falico
2014-06-02 17:21     ` Florian Fainelli
2014-06-02 18:10     ` David Miller
2014-06-03  7:07       ` Michal Privoznik
2014-06-03 12:05         ` Michal Privoznik

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140602143557.GA2925@minipsycho.orion \
    --to=jiri@resnulli.us \
    --cc=davem@davemloft.net \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mprivozn@redhat.com \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®