aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/mtd/mtdconcat.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/mtd/mtdconcat.c b/drivers/mtd/mtdconcat.c
index 792b547786b8..db6de74082ad 100644
--- a/drivers/mtd/mtdconcat.c
+++ b/drivers/mtd/mtdconcat.c
@@ -427,7 +427,7 @@ static int concat_erase(struct mtd_info *mtd, struct erase_info *instr)
427 * to-be-erased area begins. Verify that the starting 427 * to-be-erased area begins. Verify that the starting
428 * offset is aligned to this region's erase size: 428 * offset is aligned to this region's erase size:
429 */ 429 */
430 if (instr->addr & (erase_regions[i].erasesize - 1)) 430 if (i < 0 || instr->addr & (erase_regions[i].erasesize - 1))
431 return -EINVAL; 431 return -EINVAL;
432 432
433 /* 433 /*
@@ -440,8 +440,8 @@ static int concat_erase(struct mtd_info *mtd, struct erase_info *instr)
440 /* 440 /*
441 * check if the ending offset is aligned to this region's erase size 441 * check if the ending offset is aligned to this region's erase size
442 */ 442 */
443 if ((instr->addr + instr->len) & (erase_regions[i].erasesize - 443 if (i < 0 || ((instr->addr + instr->len) &
444 1)) 444 (erase_regions[i].erasesize - 1)))
445 return -EINVAL; 445 return -EINVAL;
446 } 446 }
447 447