* [PATCH 9/9] tulip_core.c : out-of-bounds check.
@ 2015-03-13 14:15 Ameen Ali
2015-03-13 16:43 ` David Miller
2015-03-13 18:41 ` Sergei Shtylyov
0 siblings, 2 replies; 3+ messages in thread
From: Ameen Ali @ 2015-03-13 14:15 UTC (permalink / raw)
To: grundler; +Cc: netdev, linux-kernel, Ameen Ali
Array index 'j' is used before limits check.
Suggest put limit check before index use.
Signed-off-by : <Ameenali023@gmail.com>
---
drivers/net/ethernet/dec/tulip/tulip_core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/dec/tulip/tulip_core.c b/drivers/net/ethernet/dec/tulip/tulip_core.c
index 3b42556..ed41559 100644
--- a/drivers/net/ethernet/dec/tulip/tulip_core.c
+++ b/drivers/net/ethernet/dec/tulip/tulip_core.c
@@ -589,7 +589,7 @@ static void tulip_tx_timeout(struct net_device *dev)
(unsigned int)tp->rx_ring[i].buffer1,
(unsigned int)tp->rx_ring[i].buffer2,
buf[0], buf[1], buf[2]);
- for (j = 0; buf[j] != 0xee && j < 1600; j++)
+ for (j = 0; ((j < 1600) && buf[j] != 0xee); j++)
if (j < 100)
pr_cont(" %02x", buf[j]);
pr_cont(" j=%d\n", j);
--
2.1.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 9/9] tulip_core.c : out-of-bounds check.
2015-03-13 14:15 [PATCH 9/9] tulip_core.c : out-of-bounds check Ameen Ali
@ 2015-03-13 16:43 ` David Miller
2015-03-13 18:41 ` Sergei Shtylyov
1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2015-03-13 16:43 UTC (permalink / raw)
To: ameenali023; +Cc: grundler, netdev, linux-kernel
From: Ameen Ali <ameenali023@gmail.com>
Date: Fri, 13 Mar 2015 16:15:52 +0200
> Array index 'j' is used before limits check.
>
> Suggest put limit check before index use.
>
> Signed-off-by : <Ameenali023@gmail.com>
Applied, thanks.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 9/9] tulip_core.c : out-of-bounds check.
2015-03-13 14:15 [PATCH 9/9] tulip_core.c : out-of-bounds check Ameen Ali
2015-03-13 16:43 ` David Miller
@ 2015-03-13 18:41 ` Sergei Shtylyov
1 sibling, 0 replies; 3+ messages in thread
From: Sergei Shtylyov @ 2015-03-13 18:41 UTC (permalink / raw)
To: Ameen Ali, grundler; +Cc: netdev, linux-kernel
Hello.
On 03/13/2015 05:15 PM, Ameen Ali wrote:
> Array index 'j' is used before limits check.
> Suggest put limit check before index use.
> Signed-off-by : <Ameenali023@gmail.com>
> ---
> drivers/net/ethernet/dec/tulip/tulip_core.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
> diff --git a/drivers/net/ethernet/dec/tulip/tulip_core.c b/drivers/net/ethernet/dec/tulip/tulip_core.c
> index 3b42556..ed41559 100644
> --- a/drivers/net/ethernet/dec/tulip/tulip_core.c
> +++ b/drivers/net/ethernet/dec/tulip/tulip_core.c
> @@ -589,7 +589,7 @@ static void tulip_tx_timeout(struct net_device *dev)
> (unsigned int)tp->rx_ring[i].buffer1,
> (unsigned int)tp->rx_ring[i].buffer2,
> buf[0], buf[1], buf[2]);
> - for (j = 0; buf[j] != 0xee && j < 1600; j++)
> + for (j = 0; ((j < 1600) && buf[j] != 0xee); j++)
No need for extra parens, either around < or around &&.
WBR, Sergei
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-03-13 18:41 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-13 14:15 [PATCH 9/9] tulip_core.c : out-of-bounds check Ameen Ali
2015-03-13 16:43 ` David Miller
2015-03-13 18:41 ` Sergei Shtylyov
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).