Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp2270518ybb; Sun, 5 Apr 2020 03:15:50 -0700 (PDT) X-Google-Smtp-Source: APiQypJfklmI7xasiDTkmEyo+iiW+SUzuMgXh5MzcLOIb2tINa6+79e+GPOfCDktH+gTQllKLSGE X-Received: by 2002:a9d:5f18:: with SMTP id f24mr13414148oti.325.1586081749967; Sun, 05 Apr 2020 03:15:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586081749; cv=none; d=google.com; s=arc-20160816; b=rKTwe7gOlMmlxqxEM/8VOoSRJ9LIEXerUfsfgVnxPp+t+N2xHjA5/fRGtl7v10uyUy 9NjP8i5UK6stQu5/1surJEvGhfv7SXqNLQY2ZcD4B+TDi08NKDLpDhLZDNf2zSLmG5Jp Nmo50IXFt7wRLtj0QWnW7VfE53bWiVAFSE7EB/ZNGwLwvtZHXIWyijBteN0o6V6xaLjA NZuBsW35iTCc6Ytov5KG2DwVLU4lge0ASONCLkDyL7Mm6eUqSpU0js1wupwuKlStF5by q3N6VUpYsAw0sbJeil0tQ3rRCicBUpjbKOZ0nvW8nUvzV78371SUOkehHOipnfhajj4s FGmg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=U/MW7ws8EhYmPKvRgeUjzUL9RHH90FUjn6jmBMga+ic=; b=oM8u2cuKGGDs6SR+I2npYR7kbatbMnMWyvT+/GIp3wQE1NkY/JPhBtg0hWzaVja/Su uRLotk1xjJT1BFX2KuPgrAv6B0PS5ywdeNkYfM73Mwp3A2DeGMM0klywoQoNhRQXy8J9 q/P7Jv2ZoH2mahazE/ZFaPYBjFMkCOHhqqRBRhdr7qCJ75POQoffSRHP9+NUuLJQhdyn 5jw3qSbMt0zY4KUQuKkJsPxumBWF9Gg6CM373ulxAYqVl1sNNNO2+bPGQQzLKeENUr8u dHFrGqAKwcd4wBrQBUDtunssPItYVdJQEpw11vZZMgEEd5rfcODe89O727ftcYxG4hWg XIKg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@c-s.fr header.s=mail header.b=A7u+wZ4v; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v127si5922786oib.25.2020.04.05.03.15.37; Sun, 05 Apr 2020 03:15:49 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@c-s.fr header.s=mail header.b=A7u+wZ4v; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726546AbgDEKNy (ORCPT + 99 others); Sun, 5 Apr 2020 06:13:54 -0400 Received: from pegase1.c-s.fr ([93.17.236.30]:61055 "EHLO pegase1.c-s.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726410AbgDEKNy (ORCPT ); Sun, 5 Apr 2020 06:13:54 -0400 Received: from localhost (mailhub1-int [192.168.12.234]) by localhost (Postfix) with ESMTP id 48w8dp3QWyz9txJW; Sun, 5 Apr 2020 12:13:50 +0200 (CEST) Authentication-Results: localhost; dkim=pass reason="1024-bit key; insecure key" header.d=c-s.fr header.i=@c-s.fr header.b=A7u+wZ4v; dkim-adsp=pass; dkim-atps=neutral X-Virus-Scanned: Debian amavisd-new at c-s.fr Received: from pegase1.c-s.fr ([192.168.12.234]) by localhost (pegase1.c-s.fr [192.168.12.234]) (amavisd-new, port 10024) with ESMTP id dMABDtHwrNiZ; Sun, 5 Apr 2020 12:13:50 +0200 (CEST) Received: from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192]) by pegase1.c-s.fr (Postfix) with ESMTP id 48w8dp26Cfz9txJV; Sun, 5 Apr 2020 12:13:50 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=c-s.fr; s=mail; t=1586081630; bh=U/MW7ws8EhYmPKvRgeUjzUL9RHH90FUjn6jmBMga+ic=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=A7u+wZ4veJE+AdBa08nnR4R/k6UEP099TNMMRFz+5wFoPC7AkPwCho4iqGEeJYkFK JYPC7Veq2mDbUFdgbABi9BQr7r2Ypy5wr68RDrvZejdfpZIFW1k2F5Nh9szmWkzr8b sg+uRYLWJupcKh61f2FjQ54XGumD1aHKWUO7USwU= Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 53C028B774; Sun, 5 Apr 2020 12:13:53 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from messagerie.si.c-s.fr ([127.0.0.1]) by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023) with ESMTP id RzGBOCQrIJq2; Sun, 5 Apr 2020 12:13:53 +0200 (CEST) Received: from [192.168.4.90] (unknown [192.168.4.90]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 7FB798B764; Sun, 5 Apr 2020 12:13:52 +0200 (CEST) Subject: Re: [PATCH] powerpc/powernv: add NULL check after kzalloc in opal_add_one_export To: Qiujun Huang , benh@kernel.crashing.org, paulus@samba.org, mpe@ellerman.id.a, tglx@linutronix.de Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org References: <20200405075123.28756-1-hqjagain@gmail.com> From: Christophe Leroy Message-ID: <99de2220-5a64-e81e-6886-447296431548@c-s.fr> Date: Sun, 5 Apr 2020 12:13:03 +0200 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.6.0 MIME-Version: 1.0 In-Reply-To: <20200405075123.28756-1-hqjagain@gmail.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: fr Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Le 05/04/2020 à 09:51, Qiujun Huang a écrit : > Here needs a NULL check. > > Issue found by coccinelle. > > Signed-off-by: Qiujun Huang > --- > arch/powerpc/platforms/powernv/opal.c | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/arch/powerpc/platforms/powernv/opal.c b/arch/powerpc/platforms/powernv/opal.c > index 2b3dfd0b6cdd..09443ae3a86e 100644 > --- a/arch/powerpc/platforms/powernv/opal.c > +++ b/arch/powerpc/platforms/powernv/opal.c > @@ -811,6 +811,11 @@ static int opal_add_one_export(struct kobject *parent, const char *export_name, > goto out; > > attr = kzalloc(sizeof(*attr), GFP_KERNEL); > + if (!attr) { > + rc = -ENOMEM; > + goto out; You don't need to go to out:, there is nothing to do. You should do: if (!attr) return -ENOMEM; > + } > + > name = kstrdup(export_name, GFP_KERNEL); > if (!name) { > rc = -ENOMEM; > Christophe