summaryrefslogtreecommitdiff
path: root/src/commonlib
diff options
context:
space:
mode:
authorLee Leahy <leroy.p.leahy@intel.com>2017-06-27 09:28:35 -0700
committerLee Leahy <leroy.p.leahy@intel.com>2017-06-27 21:55:49 +0000
commitf968a4c970e2806dcf15630dc71d2ebcf54736f1 (patch)
tree05aff154cec809e803b7b4608a3b4de21890abf7 /src/commonlib
parentf138320f9e4ac5b3650f2044c0136bfc3f295c1e (diff)
commonlib/storage: Zero extend MMC capacity
Fix CID 1376472 detected by coverity. Zero extend the capacity instead of sign extending it. TEST=Build and run on reef Change-Id: I6aac422fb1dacb75e0cc44a94ff1f467ce9f529e Signed-off-by: Lee Leahy <Leroy.P.Leahy@intel.com> Reviewed-on: https://review.coreboot.org/20392 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Martin Roth <martinroth@google.com> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Diffstat (limited to 'src/commonlib')
-rw-r--r--src/commonlib/storage/mmc.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/commonlib/storage/mmc.c b/src/commonlib/storage/mmc.c
index b8a3b67495..ad7861704f 100644
--- a/src/commonlib/storage/mmc.c
+++ b/src/commonlib/storage/mmc.c
@@ -433,7 +433,7 @@ int mmc_update_capacity(struct storage_media *media)
* ext_csd's capacity is valid if the value is
* more than 2GB
*/
- capacity = (ext_csd[EXT_CSD_SEC_CNT + 0] << 0 |
+ capacity = (uint32_t)(ext_csd[EXT_CSD_SEC_CNT + 0] << 0 |
ext_csd[EXT_CSD_SEC_CNT + 1] << 8 |
ext_csd[EXT_CSD_SEC_CNT + 2] << 16 |
ext_csd[EXT_CSD_SEC_CNT + 3] << 24);