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;
|
unsigned int blkpererase;
|
||||||
off_t erasestart;
|
off_t erasestart;
|
||||||
off_t eraseend;
|
off_t eraseend;
|
||||||
off_t devblocks;
|
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
DEBUGASSERT(mtd);
|
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 */
|
/* Verify that the sub-region is valid for this geometry */
|
||||||
|
|
||||||
devblocks = blkpererase * geo.neraseblocks;
|
if (eraseend > geo.neraseblocks)
|
||||||
if (eraseend > devblocks)
|
|
||||||
{
|
{
|
||||||
ferr("ERROR: sub-region too big\n");
|
ferr("ERROR: sub-region too big\n");
|
||||||
return NULL;
|
return NULL;
|
||||||
|
Loading…
Reference in New Issue
Block a user