All of lore.kernel.org
 help / color / mirror / Atom feed
* linux-4.2-rc2/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:1993: possible bad error checking ?
@ 2015-07-13  9:48 David Binderman
  2015-07-14  6:10 ` Giuseppe CAVALLARO
  0 siblings, 1 reply; 2+ messages in thread
From: David Binderman @ 2015-07-13  9:48 UTC (permalink / raw)
  To: Giuseppe Cavallaro, netdev@vger.kernel.org

Hello there,

[linux-4.2-rc2/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:1993]: (style) Checking if unsigned variable 'entry' is less than zero.

Source code is

        entry = priv->hw->mode->jumbo_frm(priv, skb, csum_insertion);
        if (unlikely(entry < 0))
            goto dma_map_err;

but

    unsigned int entry;

So the error checking from the function call looks broken to me.

If the return value from the function call to jumbo_frm is a plain signed integer, suggest
sanity check that *before* assigning into an unsigned integer.

Regards

David Binderman

 		 	   		  

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

* Re: linux-4.2-rc2/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:1993: possible bad error checking ?
  2015-07-13  9:48 linux-4.2-rc2/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:1993: possible bad error checking ? David Binderman
@ 2015-07-14  6:10 ` Giuseppe CAVALLARO
  0 siblings, 0 replies; 2+ messages in thread
From: Giuseppe CAVALLARO @ 2015-07-14  6:10 UTC (permalink / raw)
  To: David Binderman, netdev@vger.kernel.org

Hello David

thx to have looked at this. I'll check the code and eventually fix it, 
unless you already have a patch to propose.

Kind Regards
Peppe

On 7/13/2015 11:48 AM, David Binderman wrote:
> Hello there,
>
> [linux-4.2-rc2/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:1993]: (style) Checking if unsigned variable 'entry' is less than zero.
>
> Source code is
>
>          entry = priv->hw->mode->jumbo_frm(priv, skb, csum_insertion);
>          if (unlikely(entry < 0))
>              goto dma_map_err;
>
> but
>
>      unsigned int entry;
>
> So the error checking from the function call looks broken to me.
>
> If the return value from the function call to jumbo_frm is a plain signed integer, suggest
> sanity check that *before* assigning into an unsigned integer.
>
> Regards
>
> David Binderman
>
>   		 	   		
>

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

end of thread, other threads:[~2015-07-14  6:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-07-13  9:48 linux-4.2-rc2/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:1993: possible bad error checking ? David Binderman
2015-07-14  6:10 ` Giuseppe CAVALLARO

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.