You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2021/11/30 16:43:34 UTC

[incubator-nuttx] branch master updated: fix overflow checks in mtdpart

This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git


The following commit(s) were added to refs/heads/master by this push:
     new 7f11255  fix overflow checks in mtdpart
7f11255 is described below

commit 7f112556620ca7d931bdd9b16f13569071b090c7
Author: Sebastien Lorquet <se...@lorquet.fr>
AuthorDate: Tue Nov 30 16:13:17 2021 +0100

    fix overflow checks in mtdpart
---
 drivers/mtd/mtd_partition.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/mtd/mtd_partition.c b/drivers/mtd/mtd_partition.c
index 182064d..e8792e2 100644
--- a/drivers/mtd/mtd_partition.c
+++ b/drivers/mtd/mtd_partition.c
@@ -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;