From: Roel Kluin Date: Mon, 26 Oct 2009 14:28:11 +0000 (+0100) Subject: airo: Reorder tests, check bounds before element X-Git-Tag: v2.6.32-rc6~9^2~17^2~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=30bd5726730e374a81c9e677d1a5ba2cf8f94a7c;p=platform%2Fkernel%2Flinux-stable.git airo: Reorder tests, check bounds before element Test whether index is within bounds before reading the element Signed-off-by: Roel Kluin Signed-off-by: John W. Linville --- diff --git a/drivers/net/wireless/airo.c b/drivers/net/wireless/airo.c index 7116a1a..abf896a 100644 --- a/drivers/net/wireless/airo.c +++ b/drivers/net/wireless/airo.c @@ -4790,9 +4790,8 @@ static int proc_stats_rid_open( struct inode *inode, static int get_dec_u16( char *buffer, int *start, int limit ) { u16 value; int valid = 0; - for( value = 0; buffer[*start] >= '0' && - buffer[*start] <= '9' && - *start < limit; (*start)++ ) { + for (value = 0; *start < limit && buffer[*start] >= '0' && + buffer[*start] <= '9'; (*start)++) { valid = 1; value *= 10; value += buffer[*start] - '0';