Skip to contentSkip to conversation

Coverity: rswitch_gwca_queue_alloc_skb(): Control flow issues

DISCUSSION coverity-bot 2 participants 2 messages Nov 4, 2022 – Nov 7, 2022

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

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

Addresses-Coverity-ID: 1527147 ("Control flow issues")

Fixes 3590918b5d07 ("net: ethernet: renesas: Add support for "Ethernet Switch"")

Thanks for your attention!

Signature · 1 line
Coverity-bot
#1 lore raw

Hello!

Quoted 6 lines

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>

Quoted 24 lines

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     	}
Quoted 6 lines

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

Quoted 8 lines

Addresses-Coverity-ID: 1527147 ("Control flow issues")

Fixes 3590918b5d07 ("net: ethernet: renesas: Add support for "Ethernet Switch"")

Thanks for your attention!

--
Coverity-bot