Commit 30bd5726 authored by Roel Kluin's avatar Roel Kluin Committed by John W. Linville

airo: Reorder tests, check bounds before element

Test whether index is within bounds before reading the element
Signed-off-by: default avatarRoel Kluin <roel.kluin@gmail.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 9b1ce526
...@@ -4790,9 +4790,8 @@ static int proc_stats_rid_open( struct inode *inode, ...@@ -4790,9 +4790,8 @@ static int proc_stats_rid_open( struct inode *inode,
static int get_dec_u16( char *buffer, int *start, int limit ) { static int get_dec_u16( char *buffer, int *start, int limit ) {
u16 value; u16 value;
int valid = 0; int valid = 0;
for( value = 0; buffer[*start] >= '0' && for (value = 0; *start < limit && buffer[*start] >= '0' &&
buffer[*start] <= '9' && buffer[*start] <= '9'; (*start)++) {
*start < limit; (*start)++ ) {
valid = 1; valid = 1;
value *= 10; value *= 10;
value += buffer[*start] - '0'; value += buffer[*start] - '0';
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment