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] [day] [month] [year] [list]
Date:   Mon, 7 Oct 2019 15:22:50 +0000
From:   Jose Abreu <Jose.Abreu@...opsys.com>
To:     David Miller <davem@...emloft.net>,
        "Jose.Abreu@...opsys.com" <Jose.Abreu@...opsys.com>
CC:     "netdev@...r.kernel.org" <netdev@...r.kernel.org>,
        "Joao.Pinto@...opsys.com" <Joao.Pinto@...opsys.com>,
        "peppe.cavallaro@...com" <peppe.cavallaro@...com>,
        "alexandre.torgue@...com" <alexandre.torgue@...com>,
        "mcoquelin.stm32@...il.com" <mcoquelin.stm32@...il.com>,
        "linux-stm32@...md-mailman.stormreply.com" 
        <linux-stm32@...md-mailman.stormreply.com>,
        "linux-arm-kernel@...ts.infradead.org" 
        <linux-arm-kernel@...ts.infradead.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: RE: [PATCH net-next] net: stmmac: Fix sparse warning

From: David Miller <davem@...emloft.net>
Date: Oct/07/2019, 15:14:26 (UTC+00:00)

> From: Jose Abreu <Jose.Abreu@...opsys.com>
> Date: Mon,  7 Oct 2019 15:16:08 +0200
> 
> > diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> > index 8b76745a7ec4..40b0756f3a14 100644
> > --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> > +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> > @@ -4207,6 +4207,7 @@ static u32 stmmac_vid_crc32_le(__le16 vid_le)
> >  static int stmmac_vlan_update(struct stmmac_priv *priv, bool is_double)
> >  {
> >  	u32 crc, hash = 0;
> > +	__le16 pmatch = 0;
> >  	int count = 0;
> >  	u16 vid = 0;
> >  
> > @@ -4221,11 +4222,11 @@ static int stmmac_vlan_update(struct stmmac_priv *priv, bool is_double)
> >  		if (count > 2) /* VID = 0 always passes filter */
> >  			return -EOPNOTSUPP;
> >  
> > -		vid = cpu_to_le16(vid);
> > +		pmatch = cpu_to_le16(vid);
> >  		hash = 0;
> >  	}
> >  
> > -	return stmmac_update_vlan_hash(priv, priv->hw, hash, vid, is_double);
> > +	return stmmac_update_vlan_hash(priv, priv->hw, hash, pmatch, is_double);
> >  }
> 
> I dunno about this.
> 
> The original code would use the last "vid" iterated over in the
> for_each_set_bit() loop if the priv->dma_cap.vlhash test does not
> pass.
> 
> Now, it will use zero in that case.
> 
> This does not look like an equivalent transformation.

It is intended behavior. HW specific callbacks: 
dwmac4_update_vlan_hash() / dwxgmac2_update_vlan_hash(), will either use 
Hash method or Perfect method so if priv->dma_cap.vlhash is not 
available then pmatch will be last vid. Otherwise, it will be zero and 
hash will be populated.

---
Thanks,
Jose Miguel Abreu

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ