lkml.org 
[lkml]   [2015]   [Mar]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 9/9] tulip_core.c : out-of-bounds check.
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



\
 
 \ /
  Last update: 2015-03-13 20:01    [W:0.051 / U:0.368 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site