linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: mii: report 0 for unknown lp_advertising
@ 2016-11-08 13:31 Arnd Bergmann
  2016-11-08 13:37 ` Arnd Bergmann
  2016-11-10  1:27 ` David Miller
  0 siblings, 2 replies; 3+ messages in thread
From: Arnd Bergmann @ 2016-11-08 13:31 UTC (permalink / raw)
  To: David S. Miller, Philippe Reynes; +Cc: Arnd Bergmann, netdev, linux-kernel

The newly introduced mii_ethtool_get_link_ksettings function sets
lp_advertising to an uninitialized value when BMCR_ANENABLE is not
set:

drivers/net/mii.c: In function 'mii_ethtool_get_link_ksettings':
drivers/net/mii.c:224:2: error: 'lp_advertising' may be used uninitialized in this function [-Werror=maybe-uninitialized]

As documented in include/uapi/linux/ethtool.h, the value is
expected to be zero when we don't know it, so let's initialize
it to that.

Fixes: bc8ee596afe8 ("net: mii: add generic function to support ksetting support")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/net/mii.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/mii.c b/drivers/net/mii.c
index 0443546fc427..6d953c53eed6 100644
--- a/drivers/net/mii.c
+++ b/drivers/net/mii.c
@@ -213,6 +213,8 @@ int mii_ethtool_get_link_ksettings(struct mii_if_info *mii,
 				    SPEED_100 : SPEED_10));
 		cmd->base.duplex = (bmcr & BMCR_FULLDPLX) ?
 			DUPLEX_FULL : DUPLEX_HALF;
+
+		lp_advertising = 0;
 	}
 
 	mii->full_duplex = cmd->base.duplex;
-- 
2.9.0

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] net: mii: report 0 for unknown lp_advertising
  2016-11-08 13:31 [PATCH] net: mii: report 0 for unknown lp_advertising Arnd Bergmann
@ 2016-11-08 13:37 ` Arnd Bergmann
  2016-11-10  1:27 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: Arnd Bergmann @ 2016-11-08 13:37 UTC (permalink / raw)
  To: David S. Miller; +Cc: Philippe Reynes, netdev, linux-kernel

On Tuesday, November 8, 2016 2:31:38 PM CET Arnd Bergmann wrote:
> The newly introduced mii_ethtool_get_link_ksettings function sets
> lp_advertising to an uninitialized value when BMCR_ANENABLE is not
> set:
> 
> drivers/net/mii.c: In function 'mii_ethtool_get_link_ksettings':
> drivers/net/mii.c:224:2: error: 'lp_advertising' may be used uninitialized in this function [-Werror=maybe-uninitialized]
> 
> As documented in include/uapi/linux/ethtool.h, the value is
> expected to be zero when we don't know it, so let's initialize
> it to that.
> 
> Fixes: bc8ee596afe8 ("net: mii: add generic function to support ksetting support")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

In case there was any doubt: the patch causing this is currently in net-next
and has just shown up in linux-next.

	Arnd

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] net: mii: report 0 for unknown lp_advertising
  2016-11-08 13:31 [PATCH] net: mii: report 0 for unknown lp_advertising Arnd Bergmann
  2016-11-08 13:37 ` Arnd Bergmann
@ 2016-11-10  1:27 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2016-11-10  1:27 UTC (permalink / raw)
  To: arnd; +Cc: tremyfr, netdev, linux-kernel

From: Arnd Bergmann <arnd@arndb.de>
Date: Tue,  8 Nov 2016 14:31:38 +0100

> The newly introduced mii_ethtool_get_link_ksettings function sets
> lp_advertising to an uninitialized value when BMCR_ANENABLE is not
> set:
> 
> drivers/net/mii.c: In function 'mii_ethtool_get_link_ksettings':
> drivers/net/mii.c:224:2: error: 'lp_advertising' may be used uninitialized in this function [-Werror=maybe-uninitialized]
> 
> As documented in include/uapi/linux/ethtool.h, the value is
> expected to be zero when we don't know it, so let's initialize
> it to that.
> 
> Fixes: bc8ee596afe8 ("net: mii: add generic function to support ksetting support")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

Applied.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-11-10  1:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-11-08 13:31 [PATCH] net: mii: report 0 for unknown lp_advertising Arnd Bergmann
2016-11-08 13:37 ` Arnd Bergmann
2016-11-10  1:27 ` David Miller

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).