Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp2280617ybb; Sun, 5 Apr 2020 03:32:33 -0700 (PDT) X-Google-Smtp-Source: APiQypKpJyNfTrvdDQhMWE7wK5yGxM6FxYkdfn4lwcLqLviGGx2+saCB84X3AUJamYFu0XTiD6ag X-Received: by 2002:aca:ebc5:: with SMTP id j188mr9494121oih.65.1586082753302; Sun, 05 Apr 2020 03:32:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586082753; cv=none; d=google.com; s=arc-20160816; b=rDT8XyhlSg3a+XK86Yt40fdHVV3G94hz1/h9dG95hC0GBzScXt99hDUmgoZCK6I/jj xef4KTI4zrVIm51tFTAN35qTLu0Fh36K/xv8gMzyR7wwBxzTK8zx4OhgVWslQpL51xYR JvGsvm5gDgvMfQrkOBjpTJoKdj+KMGEZzRmgz73hqL92JWTSJSMj3mq6qgg6xe7PFbTG pLLAcJ0pVVIEvu+uXVOxW59GA2nQyHvighteMANyb3hqUX7jya8n2IFzpHWMHgOm4aTd tvFrgB6CtM80FxAY2P6EoH64qGfPNb1gQOd9vKlXBYIIV/wQrCLlL4JvE6HSfkv/rpBW RDLg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature; bh=qinCPIMlZEhPNHm7wWCE1/v5NXvmFAaiCevaQ476mMU=; b=n3uWBGpOWWPc89VfJzea98bVJ3tSCoUuzPTIIrm8+pTE/ZTI+mLJwv7Tt9jgGqCg+n nee42UENH0S8f5+s7WrBNrcBV9UE/Z8Y/19+xG7JMrqNP9HA438bilHPx8GthSpgiVog r878DgKsL1dChN0VWO45gvSpexnrBXWM82b+m7i0RaGwRNu+aOz+AdxCCoGHOujsyNxp jU8HeWsuGaVCJQm8N/yA0ooTEZSq/RD/j9XU5p+LwQk5ONFX2On6Bj7BQa2OfYZZK80I UNweVY/V6d+Fnw4VFO/hSsEShl37aKx1wUMwjOSmWTAH2RF5/3fbOZ7FKra2ob1V6TS6 r+jA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=pYDVOzYS; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 96si6496388otn.253.2020.04.05.03.32.21; Sun, 05 Apr 2020 03:32:33 -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=@gmail.com header.s=20161025 header.b=pYDVOzYS; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726475AbgDEKbI (ORCPT + 99 others); Sun, 5 Apr 2020 06:31:08 -0400 Received: from mail-pg1-f195.google.com ([209.85.215.195]:35750 "EHLO mail-pg1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726443AbgDEKbI (ORCPT ); Sun, 5 Apr 2020 06:31:08 -0400 Received: by mail-pg1-f195.google.com with SMTP id k5so6076595pga.2 for ; Sun, 05 Apr 2020 03:31:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=qinCPIMlZEhPNHm7wWCE1/v5NXvmFAaiCevaQ476mMU=; b=pYDVOzYSqSqQqWF1YQl0SGrQi7oysyqgKEqFg1L80NxFZL0EVvc5cwWXsXK1ZzGPHZ 75j7uXZHwIb17izPRUR4eoRyK13qJz7Ez+YU6p3ovEO1zGlOAIj4KSaKpjupSGczJ6hJ J+RCILQRTNOYyjshk0yrBh8hhup+3xTEuPjxV/wnv5c/z35c3hrD0sHpfBfAUB5L8CoH /X07g7Q+vmCoZWxXM/UiKZ+TMFLdZNnjwg2OoBjpb8BkxvRao7+XhdO++wYJ+RqeFLNu 7cmTLemLnhnCdxemUvSRerr7NrAN6pUy4ljN1TBjq/hYjh5hqilsig6bdjwdhJqJLr0t tSsg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=qinCPIMlZEhPNHm7wWCE1/v5NXvmFAaiCevaQ476mMU=; b=oBXMtlTjWUtBXGUXwIE/rNryer35SWN/Jcp103ipesrR1EfyK0BC1PrXDWDkZGSDVF odxYV7ks/5GGjKtENxbJU2CX1MxWQYeBgaLTF+NmNhO0WOrJ7SlIIcl5WnUgHvE6TRzM khl2PTSEev0yRTNoXEvgFyWx1Y1CQaK/dta4iBbHwl0BFH4jf1lvFPocUoX0vTC18CMe DQfopSAp7angCFUAsqnzd0kWkivF2+o+tqJWXHfb879HiA4tasurmIFG8m7Ac0HU5SG7 7oEeE68R4s4RTcbKeBICOoftpZ7lH/MWvJ9D3zrTHXdH5Zb77f7MNb8IuaV5T3WdCiTP xFBA== X-Gm-Message-State: AGi0PuYuRCj3MSJbYSVrReRAQJ+Dja9FZ4w1hLUu2JoyhvLvlNLQGp87 MPVjnptpD3JfuV+oIMLtlmk= X-Received: by 2002:a63:ee4f:: with SMTP id n15mr654418pgk.149.1586082666760; Sun, 05 Apr 2020 03:31:06 -0700 (PDT) Received: from localhost (n112120135125.netvigator.com. [112.120.135.125]) by smtp.gmail.com with ESMTPSA id b2sm9357482pjc.6.2020.04.05.03.31.05 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 05 Apr 2020 03:31:06 -0700 (PDT) From: Qiujun Huang To: benh@kernel.crashing.org, paulus@samba.org, mpe@ellerman.id.au, tglx@linutronix.de Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, christophe.leroy@c-s.fr, Qiujun Huang Subject: [PATCH v2] powerpc/powernv: add NULL check after kzalloc in opal_add_one_export Date: Sun, 5 Apr 2020 18:30:59 +0800 Message-Id: <20200405103059.30769-1-hqjagain@gmail.com> X-Mailer: git-send-email 2.17.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Here needs a NULL check. Issue found by coccinelle. Signed-off-by: Qiujun Huang --- arch/powerpc/platforms/powernv/opal.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/platforms/powernv/opal.c b/arch/powerpc/platforms/powernv/opal.c index 2b3dfd0b6cdd..5b98c98817aa 100644 --- a/arch/powerpc/platforms/powernv/opal.c +++ b/arch/powerpc/platforms/powernv/opal.c @@ -808,9 +808,12 @@ static int opal_add_one_export(struct kobject *parent, const char *export_name, rc = of_property_read_u64_array(np, prop_name, &vals[0], 2); if (rc) - goto out; + return rc; attr = kzalloc(sizeof(*attr), GFP_KERNEL); + if (!attr) + return -ENOMEM; + name = kstrdup(export_name, GFP_KERNEL); if (!name) { rc = -ENOMEM; -- 2.17.1