mtd: mtd_blk: Map table length round up to erase size
Change-Id: I5f615d37a572ce0d8ceb8d6d6b76983fc61e316b Signed-off-by: Jon Lin <jon.lin@rock-chips.com>
This commit is contained in:
parent
51ceae363d
commit
e091dc9d13
|
|
@ -59,7 +59,8 @@ int mtd_blk_map_table_init(struct blk_desc *desc,
|
|||
}
|
||||
|
||||
blk_begin = (u32)offset >> mtd->erasesize_shift;
|
||||
blk_cnt = ((u32)((offset & mtd->erasesize_mask) + length) >> mtd->erasesize_shift);
|
||||
blk_cnt = ((u32)((offset & mtd->erasesize_mask) + length + \
|
||||
mtd->erasesize - 1) >> mtd->erasesize_shift);
|
||||
if (blk_begin >= blk_total) {
|
||||
pr_err("map table blk begin[%d] overflow\n", blk_begin);
|
||||
return -EINVAL;
|
||||
|
|
|
|||
Loading…
Reference in New Issue