From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eugeniu Rosca Date: Mon, 20 Aug 2018 02:00:26 +0200 Subject: [U-Boot] [PATCH 2/8] mmc: Fix "left shift in type int" undefined behavior In-Reply-To: <20180820000033.25519-1-erosca@de.adit-jv.com> References: <20180820000033.25519-1-erosca@de.adit-jv.com> Message-ID: <20180820000033.25519-3-erosca@de.adit-jv.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de 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 --- 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