fix overflow checks in mtdpart
This commit is contained in:
parent
d4a5003376
commit
7f11255662
|
@ -777,7 +777,6 @@ FAR struct mtd_dev_s *mtd_partition(FAR struct mtd_dev_s *mtd,
|
|||
unsigned int blkpererase;
|
||||
off_t erasestart;
|
||||
off_t eraseend;
|
||||
off_t devblocks;
|
||||
int ret;
|
||||
|
||||
DEBUGASSERT(mtd);
|
||||
|
@ -815,8 +814,7 @@ FAR struct mtd_dev_s *mtd_partition(FAR struct mtd_dev_s *mtd,
|
|||
|
||||
/* Verify that the sub-region is valid for this geometry */
|
||||
|
||||
devblocks = blkpererase * geo.neraseblocks;
|
||||
if (eraseend > devblocks)
|
||||
if (eraseend > geo.neraseblocks)
|
||||
{
|
||||
ferr("ERROR: sub-region too big\n");
|
||||
return NULL;
|
||||
|
|
Loading…
Reference in New Issue