From nobody Sun Jun 14 13:03:25 2026 Received: from cstnet.cn (smtp81.cstnet.cn [159.226.251.81]) (using TLSv1.2 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6374F221D96 for ; Fri, 3 Apr 2026 05:33:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=159.226.251.81 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775194437; cv=none; b=jBDRPcmD3pobPN/hsBOTU+++ju6Vb1UFXd1u/Fa83mJI+yd6Frz7gwcvu2vz47JOPjeSeGKvyx8sIf5HUNWtbCB12QgMtChWUYDhjLOyEmec4Ju7cI69n+pltzY5yS8g12H6gCrRsw+AWEg01CHOy9XqS6G8mL9MIB/SOusWE64= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775194437; c=relaxed/simple; bh=U6VulrS4BtGdPURh+6UE4RaaBlaBWtjkGF9oenLwLR8=; h=From:Date:Message-ID:To:Cc:Subject; b=oximE8GMHvGOXKWDoxWFp5GksGcyfyyKb0LOvLcquexFFpHvDUP1WBMFaEj1Ej23MGeBwQk2tqC8nauwiHPFOShnnyA3PMBlOoIxouObFOff1ClzJAQ9XoZgTcTsepoU9q2GWsDBqiFs3EHOraNc8nlwH/dKO/+iOXnOWj3Z8Fk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=iscas.ac.cn; spf=pass smtp.mailfrom=iscas.ac.cn; arc=none smtp.client-ip=159.226.251.81 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=iscas.ac.cn Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=iscas.ac.cn Received: from 0004-arm-mvebu.resend.eml (unknown [111.196.245.197]) by APP-03 (Coremail) with SMTP id rQCowABXdt09Uc9pjkK7DA--.32225S2; Fri, 03 Apr 2026 13:33:50 +0800 (CST) From: Pengpeng Hou Date: Fri, 3 Apr 2026 10:42:46 +0800 Message-ID: <20260403151504.4-dt-arm-mvebu-resend-pengpeng@iscas.ac.cn> To: Andrew Lunn , Gregory Clement , Sebastian Hesselbarth Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, pengpeng@iscas.ac.cn Subject: [PATCH] ARM: mvebu: validate memory node device_type strings X-CM-TRANSID: rQCowABXdt09Uc9pjkK7DA--.32225S2 X-Coremail-Antispam: 1UD129KBjvJXoW7uFW7WFy5tFy3tFW8Ww4xtFb_yoW8Jw4xpF Z8CF1DAF4Y9ryxGasFvrn2va4jva1kArWqyFy5Cw1j93Waq345XrZ3K3Wjyw18u3yjk3Wr CrW5WF4kZan8CFJanT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUkq14x267AKxVWUJVW8JwAFc2x0x2IEx4CE42xK8VAvwI8IcIk0 rVWrJVCq3wAFIxvE14AKwVWUJVWUGwA2ocxC64kIII0Yj41l84x0c7CEw4AK67xGY2AK02 1l84ACjcxK6xIIjxv20xvE14v26ryj6F1UM28EF7xvwVC0I7IYx2IY6xkF7I0E14v26r4j 6F4UM28EF7xvwVC2z280aVAFwI0_GcCE3s1l84ACjcxK6I8E87Iv6xkF7I0E14v26rxl6s 0DM2AIxVAIcxkEcVAq07x20xvEncxIr21l5I8CrVACY4xI64kE6c02F40Ex7xfMcIj6xII jxv20xvE14v26r1Y6r17McIj6I8E87Iv67AKxVW8JVWxJwAm72CE4IkC6x0Yz7v_Jr0_Gr 1lF7xvr2IY64vIr41lF7I21c0EjII2zVCS5cI20VAGYxC7MxkF7I0En4kS14v26r126r1D MxAIw28IcxkI7VAKI48JMxC20s026xCaFVCjc4AY6r1j6r4UMI8I3I0E5I8CrVAFwI0_Jr 0_Jr4lx2IqxVCjr7xvwVAFwI0_JrI_JrWlx4CE17CEb7AF67AKxVWUAVWUtwCIc40Y0x0E wIxGrwCI42IY6xIIjxv20xvE14v26r1j6r1xMIIF0xvE2Ix0cI8IcVCY1x0267AKxVW8JV WxJwCI42IY6xAIw20EY4v20xvaj40_Jr0_JF4lIxAIcVC2z280aVAFwI0_Gr0_Cr1lIxAI cVC2z280aVCY1x0267AKxVW8JVW8JrUvcSsGvfC2KfnxnUUI43ZEXa7VUjIJmUUUUUU== X-CM-SenderInfo: pshqw1xhqjqxpvfd2hldfou0/ Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" mvebu_scan_mem() fetches the raw device_type property and immediately compares it with strcmp(). Flat DT properties are external boot input, and this path does not prove that the property is NUL-terminated within its declared bounds. Use fdt_stringlist_get() so malformed unterminated device_type properties are rejected before they are used as C strings. Signed-off-by: Pengpeng Hou --- arch/arm/mach-mvebu/board-v7.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/arch/arm/mach-mvebu/board-v7.c b/arch/arm/mach-mvebu/board-v7.c index a0740ab0dca9..f867f6233108 100644 --- a/arch/arm/mach-mvebu/board-v7.c +++ b/arch/arm/mach-mvebu/board-v7.c @@ -11,6 +11,7 @@ =20 #include #include +#include #include #include #include @@ -66,7 +67,8 @@ void __iomem *mvebu_get_scu_base(void) static int __init mvebu_scan_mem(unsigned long node, const char *uname, int depth, void *data) { - const char *type =3D of_get_flat_dt_prop(node, "device_type", NULL); + const char *type =3D fdt_stringlist_get(initial_boot_params, node, + "device_type", 0, NULL); const __be32 *reg, *endp; int l; =20 --=20 2.50.1 (Apple Git-155)