partitions: aix.c: off by one bug
Subsystems (2)
PATCH 1/1 partitions: aix.c: off by one bug
The lvip[] array has "state->limit" elements so the condition here should be >= instead of >.
block/partitions/aix.c +1 -1
@@ -253,7 +253,7 @@ int aix_partition(struct parsed_partitions *state)continue ; } lv_ix =be16_to_cpu (p->lv_ix) -1 ; -if (lv_ix > state->limit) { +if (lv_ix >= state->limit) { cur_lv_ix =-1 ;continue ; }
Quoted 11 lines · Dan Carpenter
The lvip[] array has "
state->limit" elements so the condition here should be >= instead of >.Fixes 6ceea22bbbc8 ('partitions: add aix lvm partition support files')Signed-off-by Dan Carpenter <[email protected]>block/partitions/aix.c +0
-0
block/partitions/aix.c int aix_partition(struct parsed_partitions *state) · line 259
Quoted 8 lines
block/partitions/aix.c +1
-1@@ -253,7 +253,7 @@ int aix_partition(struct parsed_partitions *state)continue ; } lv_ix =be16_to_cpu (p->lv_ix) -1 ; -if (lv_ix > state->limit) { +if (lv_ix >= state->limit) { cur_lv_ix =-1 ;continue ; }
Thanks
Did you encounter the bug in real life, or only by code review ?
If this has a real risk to happen, a pr_warn would be welcome.
Philippe
Signature · 1 line
Philippe De Muyter +32 2 6101532 Macq SA rue de l'Aeronef 2 B-1140 Bruxelles
Quoted 3 lines · Philippe De Muyter
Did you encounter the bug in real life, or only by code review ?
If this has a real risk to happen, a
pr_warnwould be welcome.
Static analysis.
regards,
dan carpenter
Quoted 12 lines · Dan Carpenter
The lvip[] array has "
state->limit" elements so the condition here should be >= instead of >.Fixes 6ceea22bbbc8 ('partitions: add aix lvm partition support files')Signed-off-by Dan Carpenter <[email protected]>block/partitions/aix.c +0
-0
block/partitions/aix.c int aix_partition(struct parsed_partitions *state) · line 259
Quoted 8 lines
block/partitions/aix.c +1
-1@@ -253,7 +253,7 @@ int aix_partition(struct parsed_partitions *state)continue ; } lv_ix =be16_to_cpu (p->lv_ix) -1 ; -if (lv_ix > state->limit) { +if (lv_ix >= state->limit) { cur_lv_ix =-1 ;continue ; }
Applied, thanks.
Signature · 1 line
Jens Axboe