diff options
author | Jerry Huang <Chang-Ming.Huang@freescale.com> | 2012-11-06 15:33:12 +0000 |
---|---|---|
committer | Tom Rini <trini@ti.com> | 2012-12-06 13:56:39 -0700 |
commit | 33699df12cbcd9bfa609dc7fb5a0a69c029449e9 (patch) | |
tree | 38c47b1880aa925434df5875cb85342bb978e4fe | |
parent | e3ff797cdb3c4e4b2147013fa1b25a04ecc21fc4 (diff) | |
download | u-boot-imx-33699df12cbcd9bfa609dc7fb5a0a69c029449e9.zip u-boot-imx-33699df12cbcd9bfa609dc7fb5a0a69c029449e9.tar.gz u-boot-imx-33699df12cbcd9bfa609dc7fb5a0a69c029449e9.tar.bz2 |
part: check each variable for capability calculation
In order to calculate the capability, we use the below expression to check:
((dev_desc->lba * dev_desc->blksz)>0L)
If the capability is greater than 4GB (e.g. 8GB = 8 * 1024 * 104 * 1024),
the result will overflow, the low 32bit may be zero.
Therefore, change to check each variable to fix this potential issue.
Signed-off-by: Jerry Huang <Chang-Ming.Huang@freescale.com>
-rw-r--r-- | disk/part.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/disk/part.c b/disk/part.c index 4646f68..7bdc90e 100644 --- a/disk/part.c +++ b/disk/part.c @@ -199,7 +199,7 @@ void dev_print (block_dev_desc_t *dev_desc) break; } puts ("\n"); - if ((dev_desc->lba * dev_desc->blksz)>0L) { + if (dev_desc->lba > 0L && dev_desc->blksz > 0L) { ulong mb, mb_quot, mb_rem, gb, gb_quot, gb_rem; lbaint_t lba; |