Skip to content

Commit 1d3028f

Browse files
Colin Ian Kingdavem330
authored andcommitted
net: stmmac: fix a broken u32 less than zero check
The check that queue is less or equal to zero is always true because queue is a u32; queue is decremented and will wrap around and never go -ve. Fix this by making queue an int. Detected by CoverityScan, CID#1428988 ("Unsigned compared against 0") Signed-off-by: Colin Ian King <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 426849e commit 1d3028f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/net/ethernet/stmicro/stmmac/stmmac_main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1208,7 +1208,7 @@ static int init_dma_rx_desc_rings(struct net_device *dev, gfp_t flags)
12081208
u32 rx_count = priv->plat->rx_queues_to_use;
12091209
unsigned int bfsize = 0;
12101210
int ret = -ENOMEM;
1211-
u32 queue;
1211+
int queue;
12121212
int i;
12131213

12141214
if (priv->hw->mode->set_16kib_bfsize)

0 commit comments

Comments
 (0)