From: Boris Brezillon Date: Sun, 2 Dec 2018 09:54:27 +0000 (+0100) Subject: mtd: Be more strict on the "mtdparts=" prefix check X-Git-Url: http://git.dujemihanovic.xyz/img/sics.gif?a=commitdiff_plain;h=429e048e4190b68b078c37c0012c59804e32818b;p=u-boot.git mtd: Be more strict on the "mtdparts=" prefix check strstr() does not guarantee that the string we're searching for is placed at the beginning. Use strncmp() instead. Fixes: 5db66b3aee6f ("cmd: mtd: add 'mtd' command") Signed-off-by: Boris Brezillon Tested-by: Heiko Schocher --- diff --git a/drivers/mtd/mtd_uboot.c b/drivers/mtd/mtd_uboot.c index c4434d7052..d551aee202 100644 --- a/drivers/mtd/mtd_uboot.c +++ b/drivers/mtd/mtd_uboot.c @@ -215,7 +215,7 @@ int mtd_probe_devices(void) return 0; /* Start the parsing by ignoring the extra 'mtdparts=' prefix, if any */ - if (strstr(mtdparts, "mtdparts=")) + if (!strncmp(mtdparts, "mtdparts=", sizeof("mtdparts=") - 1)) mtdparts += 9; /* For each MTD device in mtdparts */