[PATCH] fixup! mci: mci-core: add GPP support

Ahmad Fatoum a.fatoum at pengutronix.de
Mon Sep 14 11:04:30 EDT 2020


1) use %zu for size_t argument, otherwise we read garbage on 64-bit CPUs
2) use xasprintf instead of risking null pointer deref on ENOMEM

Cc: Juergen Borleis <jbe at pengutronix.de>
Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
---
 drivers/mci/mci-core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/mci/mci-core.c b/drivers/mci/mci-core.c
index 21eff2f593d8..437ecc76c96f 100644
--- a/drivers/mci/mci-core.c
+++ b/drivers/mci/mci-core.c
@@ -496,8 +496,8 @@ static __maybe_unused void mmc_extract_gpp_partitions(struct mci *mci)
 		/* Convert to bytes */
 		part_size *= wpgs;
 
-		partname = basprintf("gpp%d", idx);
-		name = basprintf("%s.%s", mci->cdevname, partname);
+		partname = xasprintf("gpp%zu", idx);
+		name = xasprintf("%s.%s", mci->cdevname, partname);
 		/* TODO read-only flag */
 		mci_part_add(mci, part_size, EXT_CSD_PART_CONFIG_ACC_GPP0 + idx,
 			     name, partname, idx, false, MMC_BLK_DATA_AREA_GP);
-- 
2.28.0




More information about the barebox mailing list