[U-Boot] [PATCH 2/8] mmc: Fix "left shift in type int" undefined	behavior
    Eugeniu Rosca 
    roscaeugeniu at gmail.com
       
    Mon Aug 20 00:00:26 UTC 2018
    
    
  
Below is reproduced both with sandbox and R-Car Gen3 arm64 U-Boot:
===================================================================
UBSAN: Undefined behaviour in drivers/mmc/mmc.c:1147:21
left shift of 1 by 31 places cannot be represented in type 'int'
===================================================================
Fixes: 272cc70b211e ("Add MMC Framework")
Signed-off-by: Eugeniu Rosca <erosca at de.adit-jv.com>
---
 drivers/mmc/mmc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
index ad429f49c992..447519f46f15 100644
--- a/drivers/mmc/mmc.c
+++ b/drivers/mmc/mmc.c
@@ -1136,7 +1136,7 @@ int mmc_getcd(struct mmc *mmc)
 #endif
 
 #if !CONFIG_IS_ENABLED(MMC_TINY)
-static int sd_switch(struct mmc *mmc, int mode, int group, u8 value, u8 *resp)
+static int sd_switch(struct mmc *mmc, uint mode, int group, u8 value, u8 *resp)
 {
 	struct mmc_cmd cmd;
 	struct mmc_data data;
-- 
2.18.0
    
    
More information about the U-Boot
mailing list