[coreboot-gerrit] Change in coreboot[master]: commonlib/storage: Zero extend MMC capacity

Lee Leahy (Code Review) gerrit at coreboot.org
Tue Jun 27 18:35:52 CEST 2017


Lee Leahy has uploaded this change for review. ( https://review.coreboot.org/20392


Change subject: commonlib/storage: Zero extend MMC capacity
......................................................................

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 at intel.com>
---
M src/commonlib/storage/mmc.c
1 file changed, 1 insertion(+), 1 deletion(-)



  git pull ssh://review.coreboot.org:29418/coreboot refs/changes/92/20392/1

diff --git a/src/commonlib/storage/mmc.c b/src/commonlib/storage/mmc.c
index b8a3b67..ad78617 100644
--- a/src/commonlib/storage/mmc.c
+++ b/src/commonlib/storage/mmc.c
@@ -433,7 +433,7 @@
 	 * 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);

-- 
To view, visit https://review.coreboot.org/20392
To unsubscribe, visit https://review.coreboot.org/settings

Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I6aac422fb1dacb75e0cc44a94ff1f467ce9f529e
Gerrit-Change-Number: 20392
Gerrit-PatchSet: 1
Gerrit-Owner: Lee Leahy <leroy.p.leahy at intel.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.coreboot.org/pipermail/coreboot-gerrit/attachments/20170627/770ac764/attachment.html>


More information about the coreboot-gerrit mailing list