WSL2-Linux-Kernel/drivers/net
Andrew Lunn 321b4d4bd1 phy: marvell/micrel: Fix Unpossible condition
commit 2b2427d064 ("phy: micrel: Add ethtool statistics counters")
from Dec 30, 2015, leads to the following static checker
warning:

        drivers/net/phy/micrel.c:609 kszphy_get_stat()
        warn: unsigned 'val' is never less than zero.

drivers/net/phy/micrel.c
   602  static u64 kszphy_get_stat(struct phy_device *phydev, int i)
   603  {
   604          struct kszphy_hw_stat stat = kszphy_hw_stats[i];
   605          struct kszphy_priv *priv = phydev->priv;
   606          u64 val;
   607
   608          val = phy_read(phydev, stat.reg);
   609          if (val < 0) {
                    ^^^^^^^
Unpossible!

   610                  val = UINT64_MAX;
   611          } else {
   612                  val = val & ((1 << stat.bits) - 1);
   613                  priv->stats[i] += val;
   614                  val = priv->stats[i];
   615          }
   616
   617          return val;
   618  }

The same problem exists in the Marvell driver. Fix both.

Fixes: 2b2427d064 ("phy: micrel: Add ethtool statistics counters")
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Reported-by: Julia.Lawall <julia.lawall@lip6.fr>
Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
2016-02-19 23:41:37 -05:00
..
appletalk
arcnet
bonding bonding: use return instead of goto 2016-02-11 09:57:00 -05:00
caif
can
cris
dsa net: dsa: mv88e6xxx: fix port VLAN maps 2016-01-29 19:41:27 -08:00
ethernet i40e/ethtool: support coalesce setting by queue 2016-02-19 22:54:10 -05:00
fddi defxx: fix build warning 2016-01-25 10:51:52 -08:00
fjes
hamradio dmascc: Return correct error codes 2016-02-16 15:32:34 -05:00
hippi
hyperv hv_netvsc: add software transmit timestamp support 2016-02-19 15:46:56 -05:00
ieee802154
ipvlan ipvlan: inherit MTU from master device 2016-02-04 19:18:53 -05:00
irda net/irda: bfin_sir: remove duplicate defines 2016-01-21 10:45:45 -08:00
phy phy: marvell/micrel: Fix Unpossible condition 2016-02-19 23:41:37 -05:00
plip net: plip: use new parport device model 2016-01-09 21:02:05 -05:00
ppp pptp: fix illegal memory access caused by multiple bind()s 2016-01-24 22:18:26 -08:00
slip
team team: track sum of rx_nohandler for all slaves 2016-02-06 02:59:51 -05:00
usb lan78xx: throttle TX path at slower than SuperSpeed USB 2016-01-28 22:51:43 -08:00
vmxnet3 Driver: Vmxnet3: Fix regression caused by 5738a09 2016-01-06 16:20:13 -05:00
wan x25_asy: Free x25_asy on x25_asy_open() failure. 2016-01-13 11:45:39 -05:00
wimax
wireless Major changes: 2016-02-16 20:38:29 -05:00
xen-netback xen-netback: implement dynamic multicast control 2016-02-07 13:58:36 -05:00
Kconfig
LICENSE.SRC
Makefile
Space.c
dummy.c
eql.c
geneve.c iptunnel: scrub packet in iptunnel_pull_header 2016-02-18 14:34:54 -05:00
ifb.c
loopback.c
macvlan.c macvlan: convert to use IFF_NO_QUEUE 2016-02-17 15:19:44 -05:00
macvtap.c
mdio.c
mii.c
netconsole.c
nlmon.c
ntb_netdev.c
rionet.c
sb1000.c
sungem_phy.c
tun.c
veth.c
virtio_net.c virtio_net: validate ethtool port setting and explain the user validation 2016-02-11 11:55:38 -05:00
vrf.c vrf: duplicate include of rtnetlink.h 2016-02-11 09:45:24 -05:00
vxlan.c iptunnel: scrub packet in iptunnel_pull_header 2016-02-18 14:34:54 -05:00
xen-netfront.c xen-netfront: request Tx response events more often 2016-01-28 16:08:55 -08:00