mtd: off by one in INFTL_dumpVUchains()
Subsystems (2)
PATCH 1/1 mtd: off by one in INFTL_dumpVUchains()
The ->PUtable[] array has "->nb_blocks" number of elemetns so this comparison should be ">=" instead of ">". Otherwise it could result in a minor read beyond the end of an array.
Signed-off-by Dan Carpenter <[email protected]>
---
Static analysis stuff. Not tested.
drivers/mtd/inftlmount.c +1 -1
@@ -518,7 +518,7 @@ void INFTL_dumpVUchains(struct INFTLrecord *s)pr_debug ("INFTL Virtual Unit Chains:\n" );for (logical =0 ; logical < s->nb_blocks; logical++) { block = s->VUtable[logical]; -if (block > s->nb_blocks) +if (block >= s->nb_blocks)continue ;pr_debug (" LOGICAL %d --> %d " , logical, block);for (i =0 ; i < s->nb_blocks; i++) {
Brian Norris
AppliedQuoted 5 lines · Dan Carpenter
The ->PUtable[] array has "->nb_blocks" number of elemetns so this comparison should be ">=" instead of ">". Otherwise it could result in a minor read beyond the end of an array.
Signed-off-by Dan Carpenter <[email protected]>
Pushed to l2-mtd.git.
Brian