Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp3988191rwb; Mon, 21 Nov 2022 02:14:23 -0800 (PST) X-Google-Smtp-Source: AA0mqf4M3TtVfRgHSV8P9USrKH13r0ndIfaIXAP9F48bLUnB6Fnj9Fbh7kENeAOqGkHw3dLMcF+1 X-Received: by 2002:a17:90a:8a86:b0:212:ec84:91d9 with SMTP id x6-20020a17090a8a8600b00212ec8491d9mr26218511pjn.139.1669025663150; Mon, 21 Nov 2022 02:14:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669025663; cv=none; d=google.com; s=arc-20160816; b=wR4ODEFU/vyiqrfFZm91AxK/BQLl8zxjLgotS4p2khsGYBPyiiZD4hxYxoi7wKLSZc EZAuEvAKsxFlIyVmZdTYOmM78jYHFiV2zT2mHOhdJX1Hf0n0nezTmfFMUb98YvsqfM19 93BYTmx8Ok6HonL21t06V0EItScVFjGsGXbYpYL3quLHOmtwAjelaHP5f3vpxXxyJQZQ P77hYlHQW2x0xMQXEdkgsnZTpquMP/jqJRnqgyBwY5zVMlWyhFtfFPuvgbIZMrxWy3IO GhNhAwALop5otGBCtQyEBc7Ap7eCDXf4t7zSYtDqj/T0tIfMLvGOIC4W8nTaMyLe7sQj +0Lw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from; bh=Sbrf7ohkuqJEVudindk7hYG8sw2Z7iokmsqy0PAy7sU=; b=D5zDyBfHgtWJyvoqR9RmT29MZ1CZbXgVLDNf9hI/lOsva1pJNtgqIdLVaca6evFcYG KehZzDejeBwBzRlxNT0E9MtD6AAVkZthg1rTrG7IYEogR5axmiRyZt/BBa/QrZsImC84 odRhHS+9W3uhHm1GRz/OB0Mmfh3gTh4baAUJqvPSnmgRngjM3UdxauQOqkXLb+13/WZ2 UOCw9uAnoMnGtd7LyZxI5Hz8vKe8P2cwu4NKYLnTaVuBMkxxicmiRswTT8OQb/N3oAyi peYAzMcINFIBNTnG66NtdRIgBPtWET1rxxO18MvM062Qd8ELhCRba2IghupvX81NnJcO hMBQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b13-20020a6541cd000000b0047767ded526si3310948pgq.100.2022.11.21.02.14.08; Mon, 21 Nov 2022 02:14:23 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231210AbiKUKBv (ORCPT + 91 others); Mon, 21 Nov 2022 05:01:51 -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 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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/coherency.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(struct device_node *np) struct property *p; p = kzalloc(sizeof(*p), GFP_KERNEL); - p->name = kstrdup("arm,io-coherent", GFP_KERNEL); - of_add_property(cache_dn, p); + if (p) { + p->name = kstrdup("arm,io-coherent", GFP_KERNEL); + of_add_property(cache_dn, p); + } } } -- 2.18.2