From f968a4c970e2806dcf15630dc71d2ebcf54736f1 Mon Sep 17 00:00:00 2001 From: Lee Leahy Date: Tue, 27 Jun 2017 09:28:35 -0700 Subject: commonlib/storage: Zero extend MMC capacity MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-on: https://review.coreboot.org/20392 Tested-by: build bot (Jenkins) Reviewed-by: Martin Roth Reviewed-by: Philippe Mathieu-Daudé --- src/commonlib/storage/mmc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') 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); -- cgit v1.2.3