lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Fri, 3 Jan 2020 18:53:18 +0100
From:   Andrew Lunn <andrew@...n.ch>
To:     Matthew Wilcox <willy@...radead.org>
Cc:     yu kuai <yukuai3@...wei.com>, klassert@...nel.org,
        davem@...emloft.net, hkallweit1@...il.com,
        jakub.kicinski@...ronome.com, hslester96@...il.com, mst@...hat.com,
        yang.wei9@....com.cn, netdev@...r.kernel.org,
        linux-kernel@...r.kernel.org, yi.zhang@...wei.com,
        zhengbin13@...wei.com
Subject: Re: [PATCH] net: 3com: 3c59x: remove set but not used variable
 'mii_reg1'

On Fri, Jan 03, 2020 at 06:46:23AM -0800, Matthew Wilcox wrote:
> On Fri, Jan 03, 2020 at 08:19:07PM +0800, yu kuai wrote:
> > Fixes gcc '-Wunused-but-set-variable' warning:
> > 
> > drivers/net/ethernet/3com/3c59x.c: In function ‘vortex_up’:
> > drivers/net/ethernet/3com/3c59x.c:1551:9: warning: variable
> > ‘mii_reg1’ set but not used [-Wunused-but-set-variable]
> > 
> > It is never used, and so can be removed.
> ...
> >  	if (dev->if_port == XCVR_MII || dev->if_port == XCVR_NWAY) {
> > -		mii_reg1 = mdio_read(dev, vp->phys[0], MII_BMSR);
> >  		mii_reg5 = mdio_read(dev, vp->phys[0], MII_LPA);
> 
> I know nothing about the MII interface, but in general this is not
> a safe thing to do.

Hi Matthew

I fully agree about the general case. However, reading the MII_BMSR
should not have any side affects. It would be an odd Ethernet PHY if
it did.

But I am curious why this read is here. There is a slim change the
MDIO bus is broken, and this is a workaround. So it would be good if
somebody dug into the history and found out when this read was added
and if there are any comments about why it is there. Or if the usage
of mii_reg1 as been removed at some point, and the read was not
cleaned up.

   Andrew

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ