net: ethernet: renesas: rswitch: Fix endless loop in error paths
authorYoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Mon, 7 Nov 2022 08:10:21 +0000 (17:10 +0900)
committerJakub Kicinski <kuba@kernel.org>
Wed, 9 Nov 2022 01:49:05 +0000 (17:49 -0800)
commit380f9acdf74729d79972b947820f00b42cc26dae
tree9d9eeb60afb6b58980ed6b25397bf1e5fcf5e26c
parent8e18be7610aebea50e9327c11afcd5eeaaa06644
net: ethernet: renesas: rswitch: Fix endless loop in error paths

Coverity reported that the error path in rswitch_gwca_queue_alloc_skb()
has an issue to cause endless loop. So, fix the issue by changing
variables' types from u32 to int. After changed the types,
rswitch_tx_free() should use rswitch_get_num_cur_queues() to
calculate number of current queues.

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"")
Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Link: https://lore.kernel.org/r/20221107081021.2955122-1-yoshihiro.shimoda.uh@renesas.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/renesas/rswitch.c
drivers/net/ethernet/renesas/rswitch.h