From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtpout-02.galae.net (smtpout-02.galae.net [185.246.84.56]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 796003A9DAF for ; Wed, 18 Mar 2026 09:34:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.246.84.56 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773826445; cv=none; b=dZnqMbhYVAYSiBNcjzthxWvFvcQVKEn0vDIvZmIDoP0RGBAhF4jROXReBNgj5IEbCT+PNViy90dGE/MMBrAiCUuHb/LgVHkh3xuRmrwRxIdQOE2o/HIlFfEgO83Wk1Xs/AXjl33aastctN9r3X9AZqnxmp6G8iHaiZ/glpW59vs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773826445; c=relaxed/simple; bh=zRTOsuRDrphiuU7prsuNPsziDcdZ5L231kQ+gB9QAL8=; h=From:To:Subject:In-Reply-To:References:Date:Message-ID: MIME-Version:Content-Type; b=tO4kvy4MK33Jcb91HH9aKnexLWte2l++jlW52m2FV/txT7RTofkUAsvah7gxzGKDToxQuUQXWawaqam/VYlyYKaK0uCAkQnAZrziXjeb4+6qxtE9aw7bPjNWBb8q8JIvbQ2Xxd7TZDa1qVIzyx4UZwTrmt4fsumSvJicYc4JJ3c= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=LWHA/kQg; arc=none smtp.client-ip=185.246.84.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="LWHA/kQg" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-02.galae.net (Postfix) with ESMTPS id 8B27C1A2EA3; Wed, 18 Mar 2026 09:33:58 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 605E56004F; Wed, 18 Mar 2026 09:33:58 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id B61E11045072A; Wed, 18 Mar 2026 10:33:54 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1773826437; h=from:subject:date:message-id:to:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=1gxzWH3BLaNkVhNWIYrhCBuNRvksYdyzaZYh9Ztxet4=; b=LWHA/kQguU697L9GowKQ/AxwVfWAMvEX9E8RbOhyjxnWLkypze7Sl4H6gK46tEFCUp+dKQ xIXvN8Il+nZwBLjU6/tNwpI6MS9TdAN7oYZy/p3cjeE+f2XcnjFt323tIEhBcVd+RcOgsr Ox3Lm4JUc6XP9ZqBiV3zQyDXgVxn+gIyaB0zmQBwyhjyNLWe2f+cA9YdhZ4H1DKX9vzH6l 73HJkpQM6G/GVVuc0apBnRoRiWjpVa0zrZM9dde2J0yH6C65oLdcGOhD07feBdWb+Cbgv8 7PuJ1GXy9nsRR1Ve7zZiChROBOeTGV/fANLMgIa1ey+jAEYdoWnWQI6zkoo61Q== From: Gregory CLEMENT To: Li Jun , andrew@lunn.ch, sebastian.hesselbarth@gmail.com, linux@armlinux.org.uk, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, lijun01@kylinos.cn Subject: Re: [PATCH v4] arm: mvebu: fix null pointer when access In-Reply-To: <20260318085923.2610585-1-lijun01@kylinos.cn> References: <20260318085923.2610585-1-lijun01@kylinos.cn> Date: Wed, 18 Mar 2026 10:33:53 +0100 Message-ID: <87a4w55vni.fsf@BLaptop.bootlin.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Last-TLS-Session-Version: TLSv1.3 Hello Li Jun, This patch looks very broken, see https://sashiko.dev/#/patchset/20260318085923.2610585-1-lijun01%40kylinos.cn > the kzalloc&kstrdup may return null pointer, will cause kernel panic. > > -Fix null pointer. You could improve this commit log. > > Signed-off-by: Li Jun When you iterate you should add a changelog here. Gregory > --- > arch/arm/mach-mvebu/board-v7.c | 10 ++++++++++ > arch/arm/mach-mvebu/coherency.c | 6 ++++++ > arch/arm/mach-mxs/mach-mxs.c | 4 ++-- > arch/arm/mach-versatile/versatile.c | 6 ++++++ > 4 files changed, 24 insertions(+), 2 deletions(-) > > diff --git a/arch/arm/mach-mvebu/board-v7.c b/arch/arm/mach-mvebu/board-v= 7.c > index 04ad651d13a0..a3b1aa48162b 100644 > --- a/arch/arm/mach-mvebu/board-v7.c > +++ b/arch/arm/mach-mvebu/board-v7.c > @@ -128,11 +128,21 @@ static void __init i2c_quirk(void) > struct property *new_compat; >=20=20 > new_compat =3D kzalloc(sizeof(*new_compat), GFP_KERNEL); > + if (!new_compat) > + return -ENOMEM; >=20=20 > new_compat->name =3D kstrdup("compatible", GFP_KERNEL); > + if (!mew_compat->name) { > + kfree(new_compat); > + return -ENOMEM; > + } > new_compat->length =3D sizeof("marvell,mv78230-a0-i2c"); > new_compat->value =3D kstrdup("marvell,mv78230-a0-i2c", > GFP_KERNEL); > + if (!mew_compat->value) { > + kfree(new_compat); > + return -ENOMEM; > + } >=20=20 > of_update_property(np, new_compat); > } > diff --git a/arch/arm/mach-mvebu/coherency.c b/arch/arm/mach-mvebu/cohere= ncy.c > index a6b621ff0b87..2c1668f3174c 100644 > --- a/arch/arm/mach-mvebu/coherency.c > +++ b/arch/arm/mach-mvebu/coherency.c > @@ -191,7 +191,13 @@ static void __init armada_375_380_coherency_init(str= uct device_node *np) > struct property *p; >=20=20 > p =3D kzalloc(sizeof(*p), GFP_KERNEL); > + if (!p) > + return -ENOMEM; > p->name =3D kstrdup("arm,io-coherent", GFP_KERNEL); > + if (!p->name) { > + kfree(p); > + return -ENOMEM; > + } > of_add_property(cache_dn, p); > } > } > diff --git a/arch/arm/mach-mxs/mach-mxs.c b/arch/arm/mach-mxs/mach-mxs.c > index 6e017fa306c8..16506d9392b4 100644 > --- a/arch/arm/mach-mxs/mach-mxs.c > +++ b/arch/arm/mach-mxs/mach-mxs.c > @@ -178,14 +178,14 @@ static void __init update_fec_mac_prop(enum mac_oui= oui) >=20=20 > newmac =3D kzalloc(sizeof(*newmac) + 6, GFP_KERNEL); > if (!newmac) > - return; > + return -ENOMEM; > newmac->value =3D newmac + 1; > newmac->length =3D 6; >=20=20 > newmac->name =3D kstrdup("local-mac-address", GFP_KERNEL); > if (!newmac->name) { > kfree(newmac); > - return; > + return -ENOMEM; > } >=20=20 > /* > diff --git a/arch/arm/mach-versatile/versatile.c b/arch/arm/mach-versatil= e/versatile.c > index f0c80d4663ca..07f2a299c770 100644 > --- a/arch/arm/mach-versatile/versatile.c > +++ b/arch/arm/mach-versatile/versatile.c > @@ -147,7 +147,13 @@ static void __init versatile_dt_pci_init(void) > goto out_put_node; >=20=20 > newprop->name =3D kstrdup("status", GFP_KERNEL); > + if (!newprop->name) > + goto out_put_node; > + > newprop->value =3D kstrdup("disabled", GFP_KERNEL); > + if (!newprop->value) > + goto out_put_node; > + > newprop->length =3D sizeof("disabled"); > of_update_property(np, newprop); >=20=20 > --=20 > 2.25.1 > --=20 Gr=C3=A9gory CLEMENT, Bootlin Embedded Linux and Kernel engineering https://bootlin.com