netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Coverity: rswitch_gwca_queue_alloc_skb(): Control flow issues
@ 2022-11-04 19:29 coverity-bot
  2022-11-07  1:38 ` Yoshihiro Shimoda
  0 siblings, 1 reply; 2+ messages in thread
From: coverity-bot @ 2022-11-04 19:29 UTC (permalink / raw)
  To: Yoshihiro Shimoda
  Cc: Jakub Kicinski, Paolo Abeni, Richard Cochran, Russell King,
	Andrew Lunn, David S. Miller, Eric Dumazet, netdev, linux-kernel,
	Sergey Shtylyov, linux-renesas-soc, Gustavo A. R. Silva,
	linux-next, linux-hardening

Hello!

This is an experimental semi-automated report about issues detected by
Coverity from a scan of next-20221104 as part of the linux-next scan project:
https://scan.coverity.com/projects/linux-next-weekly-scan

You're getting this email because you were associated with the identified
lines of code (noted below) that were touched by commits:

  Wed Nov 2 12:38:53 2022 +0000
    3590918b5d07 ("net: ethernet: renesas: Add support for "Ethernet Switch"")

Coverity reported the following:

*** CID 1527147:  Control flow issues  (NO_EFFECT)
drivers/net/ethernet/renesas/rswitch.c:270 in rswitch_gwca_queue_alloc_skb()
264     			goto err;
265     	}
266
267     	return 0;
268
269     err:
vvv     CID 1527147:  Control flow issues  (NO_EFFECT)
vvv     This greater-than-or-equal-to-zero comparison of an unsigned value is always true. "i >= 0U".
270     	for (i--; i >= 0; i--) {
271     		index = (i + start_index) % gq->ring_size;
272     		dev_kfree_skb(gq->skbs[index]);
273     		gq->skbs[index] = NULL;
274     	}
275

If this is a false positive, please let us know so we can mark it as
such, or teach the Coverity rules to be smarter. If not, please make
sure fixes get into linux-next. :) For patches fixing this, please
include these lines (but double-check the "Fixes" first):

Reported-by: coverity-bot <keescook+coverity-bot@chromium.org>
Addresses-Coverity-ID: 1527147 ("Control flow issues")
Fixes: 3590918b5d07 ("net: ethernet: renesas: Add support for "Ethernet Switch"")

Thanks for your attention!

-- 
Coverity-bot

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

* RE: Coverity: rswitch_gwca_queue_alloc_skb(): Control flow issues
  2022-11-04 19:29 Coverity: rswitch_gwca_queue_alloc_skb(): Control flow issues coverity-bot
@ 2022-11-07  1:38 ` Yoshihiro Shimoda
  0 siblings, 0 replies; 2+ messages in thread
From: Yoshihiro Shimoda @ 2022-11-07  1:38 UTC (permalink / raw)
  To: coverity-bot
  Cc: Jakub Kicinski, Paolo Abeni, Richard Cochran, Russell King,
	Andrew Lunn, David S. Miller, Eric Dumazet,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	Sergey Shtylyov, linux-renesas-soc@vger.kernel.org,
	Gustavo A. R. Silva, linux-next@vger.kernel.org,
	linux-hardening@vger.kernel.org

Hello!

> From: coverity-bot, Sent: Saturday, November 5, 2022 4:30 AM
> 
> Hello!
> 
> This is an experimental semi-automated report about issues detected by
> Coverity from a scan of next-20221104 as part of the linux-next scan project:
<snip>
> 
> You're getting this email because you were associated with the identified
> lines of code (noted below) that were touched by commits:
> 
>   Wed Nov 2 12:38:53 2022 +0000
>     3590918b5d07 ("net: ethernet: renesas: Add support for "Ethernet Switch"")
> 
> Coverity reported the following:
> 
> *** CID 1527147:  Control flow issues  (NO_EFFECT)
> drivers/net/ethernet/renesas/rswitch.c:270 in rswitch_gwca_queue_alloc_skb()
> 264     			goto err;
> 265     	}
> 266
> 267     	return 0;
> 268
> 269     err:
> vvv     CID 1527147:  Control flow issues  (NO_EFFECT)
> vvv     This greater-than-or-equal-to-zero comparison of an unsigned value is always true. "i >= 0U".
> 270     	for (i--; i >= 0; i--) {
> 271     		index = (i + start_index) % gq->ring_size;
> 272     		dev_kfree_skb(gq->skbs[index]);
> 273     		gq->skbs[index] = NULL;
> 274     	}
> 275
> 
> If this is a false positive, please let us know so we can mark it as
> such, or teach the Coverity rules to be smarter. If not, please make
> sure fixes get into linux-next. :) For patches fixing this, please
> include these lines (but double-check the "Fixes" first):

Thank you for the report! I should fix the driver. 
I also realized that rswitch_gwca_queue_ts_fill() has the same issue.

Best regards,
Yoshihiro Shimoda

> Reported-by: coverity-bot <keescook+coverity-bot@chromium.org>
> Addresses-Coverity-ID: 1527147 ("Control flow issues")
> Fixes: 3590918b5d07 ("net: ethernet: renesas: Add support for "Ethernet Switch"")
> 
> Thanks for your attention!
> 
> --
> Coverity-bot

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

end of thread, other threads:[~2022-11-07  1:38 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-11-04 19:29 Coverity: rswitch_gwca_queue_alloc_skb(): Control flow issues coverity-bot
2022-11-07  1:38 ` Yoshihiro Shimoda

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