From nobody Wed Apr 15 19:44:53 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3D0D0C4332F for ; Mon, 21 Nov 2022 10:02:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230518AbiKUKBz (ORCPT ); Mon, 21 Nov 2022 05:01:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40678 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230478AbiKUKBg (ORCPT ); Mon, 21 Nov 2022 05:01:36 -0500 Received: from mail.nfschina.com (unknown [124.16.136.209]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 751ED52175 for ; Mon, 21 Nov 2022 02:01:35 -0800 (PST) Received: from localhost (unknown [127.0.0.1]) by mail.nfschina.com (Postfix) with ESMTP id 775401E80DAB; Mon, 21 Nov 2022 17:58:07 +0800 (CST) X-Virus-Scanned: amavisd-new at test.com Received: from mail.nfschina.com ([127.0.0.1]) by localhost (mail.nfschina.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 504Ptf937N5n; Mon, 21 Nov 2022 17:58:04 +0800 (CST) Received: from localhost.localdomain (unknown [219.141.250.2]) (Authenticated sender: zeming@nfschina.com) by mail.nfschina.com (Postfix) with ESMTPA id 308F21E80DAA; Mon, 21 Nov 2022 17:58:04 +0800 (CST) From: Li zeming To: andrew@lunn.ch, gregory.clement@bootlin.com, sebastian.hesselbarth@gmail.com Cc: linux@armlinux.org.uk, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Li zeming Subject: [PATCH] mach-mvebu: coherency: Judgment after pointer p increases allocation Date: Mon, 21 Nov 2022 18:01:22 +0800 Message-Id: <20221121100122.36528-1-zeming@nfschina.com> X-Mailer: git-send-email 2.18.2 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Add judgment statements at the position after pointer p allocates memory to avoid the abnormal impact of low probability allocation failure. Signed-off-by: Li zeming --- arch/arm/mach-mvebu/coherency.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/arch/arm/mach-mvebu/coherency.c b/arch/arm/mach-mvebu/coherenc= y.c index a6b621ff0b87..2bc69dd059d6 100644 --- a/arch/arm/mach-mvebu/coherency.c +++ b/arch/arm/mach-mvebu/coherency.c @@ -191,8 +191,10 @@ static void __init armada_375_380_coherency_init(struc= t device_node *np) struct property *p; =20 p =3D kzalloc(sizeof(*p), GFP_KERNEL); - p->name =3D kstrdup("arm,io-coherent", GFP_KERNEL); - of_add_property(cache_dn, p); + if (p) { + p->name =3D kstrdup("arm,io-coherent", GFP_KERNEL); + of_add_property(cache_dn, p); + } } } =20 --=20 2.18.2