From b02f2e79c6272d97bf0bd191e6ec8e748a39ad58 Mon Sep 17 00:00:00 2001 From: Philippe Reynes Date: Tue, 19 Mar 2019 10:55:40 +0100 Subject: [PATCH 1/3] rsa: check that pointer checksum isn't NULL before using it The pointer checksum were used before checking that it isn't NULL. We move the code that use it after the check. Reported-by: Coverity (CID: 185835) Signed-off-by: Philippe Reynes Reviewed-by: Simon Glass --- lib/rsa/rsa-verify.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/rsa/rsa-verify.c b/lib/rsa/rsa-verify.c index 9734f6d3bd..287fcc4d23 100644 --- a/lib/rsa/rsa-verify.c +++ b/lib/rsa/rsa-verify.c @@ -295,7 +295,7 @@ static int rsa_verify_key(struct image_sign_info *info, #endif struct checksum_algo *checksum = info->checksum; struct padding_algo *padding = info->padding; - int hash_len = checksum->checksum_len; + int hash_len; if (!prop || !sig || !hash || !checksum) return -EIO; @@ -315,6 +315,7 @@ static int rsa_verify_key(struct image_sign_info *info, } uint8_t buf[sig_len]; + hash_len = checksum->checksum_len; #if !defined(USE_HOSTCC) ret = uclass_get_device(UCLASS_MOD_EXP, 0, &mod_exp_dev); From 00717b00a585fcf2856de29481506c6389b032d3 Mon Sep 17 00:00:00 2001 From: Tom Rini Date: Fri, 22 Mar 2019 09:47:39 -0400 Subject: [PATCH 2/3] scripts/Makefile.extrawarn: Silence more DTC warnings While our "extrawarns" logic has gotten out of sync with upstream Kbuild, for now lets start by bringing in the latest set of DTC_FLAGS from the Linux Kernel 5.0 to match their behavior in silencing warnings from dtc. Cc: Masahiro Yamada Signed-off-by: Tom Rini --- scripts/Makefile.extrawarn | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/Makefile.extrawarn b/scripts/Makefile.extrawarn index 7ed520f555..1105c76be1 100644 --- a/scripts/Makefile.extrawarn +++ b/scripts/Makefile.extrawarn @@ -74,5 +74,7 @@ DTC_FLAGS += -Wno-unit_address_format DTC_FLAGS += -Wno-pci_bridge DTC_FLAGS += -Wno-pci_device_bus_num DTC_FLAGS += -Wno-pci_device_reg +DTC_FLAGS += -Wno-avoid_unnecessary_addr_size +DTC_FLAGS += -Wno-alias_paths endif From 7d5ccb1ae70256e0047ffcd1b866ec158567c53f Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Sat, 23 Mar 2019 18:54:45 +0100 Subject: [PATCH 3/3] mmc: Align MMC_TRACE with tiny printf The tiny printf implementation only supports %x format specifier, it does not support %X . Since it makes little difference whether the debug output prints hex numbers in capitals or not, change it to %x and make the MMC_TRACE output work with tiny printf too. Signed-off-by: Marek Vasut Cc: Jaehoon Chung Cc: Simon Glass --- drivers/mmc/mmc.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c index 1c1527cc74..89b255daf4 100644 --- a/drivers/mmc/mmc.c +++ b/drivers/mmc/mmc.c @@ -67,7 +67,7 @@ __weak int board_mmc_getcd(struct mmc *mmc) void mmmc_trace_before_send(struct mmc *mmc, struct mmc_cmd *cmd) { printf("CMD_SEND:%d\n", cmd->cmdidx); - printf("\t\tARG\t\t\t 0x%08X\n", cmd->cmdarg); + printf("\t\tARG\t\t\t 0x%08x\n", cmd->cmdarg); } void mmmc_trace_after_send(struct mmc *mmc, struct mmc_cmd *cmd, int ret) @@ -83,21 +83,21 @@ void mmmc_trace_after_send(struct mmc *mmc, struct mmc_cmd *cmd, int ret) printf("\t\tMMC_RSP_NONE\n"); break; case MMC_RSP_R1: - printf("\t\tMMC_RSP_R1,5,6,7 \t 0x%08X \n", + printf("\t\tMMC_RSP_R1,5,6,7 \t 0x%08x \n", cmd->response[0]); break; case MMC_RSP_R1b: - printf("\t\tMMC_RSP_R1b\t\t 0x%08X \n", + printf("\t\tMMC_RSP_R1b\t\t 0x%08x \n", cmd->response[0]); break; case MMC_RSP_R2: - printf("\t\tMMC_RSP_R2\t\t 0x%08X \n", + printf("\t\tMMC_RSP_R2\t\t 0x%08x \n", cmd->response[0]); - printf("\t\t \t\t 0x%08X \n", + printf("\t\t \t\t 0x%08x \n", cmd->response[1]); - printf("\t\t \t\t 0x%08X \n", + printf("\t\t \t\t 0x%08x \n", cmd->response[2]); - printf("\t\t \t\t 0x%08X \n", + printf("\t\t \t\t 0x%08x \n", cmd->response[3]); printf("\n"); printf("\t\t\t\t\tDUMPING DATA\n"); @@ -107,12 +107,12 @@ void mmmc_trace_after_send(struct mmc *mmc, struct mmc_cmd *cmd, int ret) ptr = (u8 *)&cmd->response[i]; ptr += 3; for (j = 0; j < 4; j++) - printf("%02X ", *ptr--); + printf("%02x ", *ptr--); printf("\n"); } break; case MMC_RSP_R3: - printf("\t\tMMC_RSP_R3,4\t\t 0x%08X \n", + printf("\t\tMMC_RSP_R3,4\t\t 0x%08x \n", cmd->response[0]); break; default: @@ -226,7 +226,7 @@ int mmc_send_status(struct mmc *mmc, int timeout) if (cmd.response[0] & MMC_STATUS_MASK) { #if !defined(CONFIG_SPL_BUILD) || defined(CONFIG_SPL_LIBCOMMON_SUPPORT) - pr_err("Status Error: 0x%08X\n", + pr_err("Status Error: 0x%08x\n", cmd.response[0]); #endif return -ECOMM;