fix overflow checks in mtdpart

This commit is contained in:
Sebastien Lorquet 2021-11-30 16:13:17 +01:00 committed by Xiang Xiao
parent d4a5003376
commit 7f11255662
1 changed files with 1 additions and 3 deletions

View File

@ -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;