summaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorColin Ian King2017-06-06 15:10:49 +0200
committerDavid S. Miller2017-06-06 22:26:28 +0200
commit1d3028f4c16487d63861ab6c68451768a7a109df (patch)
treefc7e5b6114f4684d2ce8bc5410a1b849ce37255b /drivers/net
parentnet: stmmac: fix completely hung TX when using TSO (diff)
downloadkernel-qcow2-linux-1d3028f4c16487d63861ab6c68451768a7a109df.tar.gz
kernel-qcow2-linux-1d3028f4c16487d63861ab6c68451768a7a109df.tar.xz
kernel-qcow2-linux-1d3028f4c16487d63861ab6c68451768a7a109df.zip
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 <colin.king@canonical.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/ethernet/stmicro/stmmac/stmmac_main.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index dcbe4537ad99..12236daf7bb6 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -1208,7 +1208,7 @@ static int init_dma_rx_desc_rings(struct net_device *dev, gfp_t flags)
u32 rx_count = priv->plat->rx_queues_to_use;
unsigned int bfsize = 0;
int ret = -ENOMEM;
- u32 queue;
+ int queue;
int i;
if (priv->hw->mode->set_16kib_bfsize)