From 0fda18b7f588382ed9f433fb0a7ec25fc61ab3fc Mon Sep 17 00:00:00 2001 From: David Laight Date: Mon, 8 Jun 2026 10:55:03 +0100 Subject: [PATCH] mmc: core: Replace strcpy() in loop with memcpy() outside When copying the info strings and generating a char ** list copy all the strings into the kmalloced buffer outside the loop and use strchr(str, 0) to find the next string inside the loop. Removes some strcpy() that static tools might think are unbounded. Signed-off-by: David Laight Signed-off-by: Ulf Hansson --- drivers/mmc/core/sdio_cis.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/mmc/core/sdio_cis.c b/drivers/mmc/core/sdio_cis.c index afaa6cab1adc..0b818cb478ce 100644 --- a/drivers/mmc/core/sdio_cis.c +++ b/drivers/mmc/core/sdio_cis.c @@ -57,12 +57,11 @@ static int cistpl_vers_1(struct mmc_card *card, struct sdio_func *func, return -ENOMEM; string = (char*)(buffer + nr_strings); + memcpy(string, buf, size); for (i = 0; i < nr_strings; i++) { buffer[i] = string; - strcpy(string, buf); - string += strlen(string) + 1; - buf += strlen(buf) + 1; + string = strchr(string, 0) + 1; } if (func) { -- knotmirror 0.0.1