Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp279142yba; Sat, 13 Apr 2019 00:22:10 -0700 (PDT) X-Google-Smtp-Source: APXvYqzMVIuzK7KY6ScRjnMcwq4kAC1s+jo3Fy8v8RcLUjhjMy9ZrKnRrf85YSOxZIMwS/YDjWu8 X-Received: by 2002:a17:902:29:: with SMTP id 38mr39324423pla.178.1555140130752; Sat, 13 Apr 2019 00:22:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555140130; cv=none; d=google.com; s=arc-20160816; b=kmVNhmPsqruDopQn6Ke8zjcE1k7uMs7ZPlRpRxoFZT5ruifu7/27p6MO1zTic6lleS xaj2TTU81hVLhqnffwyvmgXUeFA1RHLarDyDTXC8Nd1Xcn3f7iVgPjUbdbNUsKXJLaoQ b7FJh1agOEy9BqKOCd9ZjCFxcTPKn5Yl/ZvHdHVpjHBwNcYObu+IOeSNKclPJBJWOuq1 jHbQ9Dbneu6gD5Vmd40ScQ2veRcN8+wtkQvau9rvszCeZUCF6K9S1R/Pa5QZN+omPiME Mbssqw/u54Xf6eu3i79u+AWSdoWcPiXL6lrTP4ORZwH+wV/y3e/iSZe1k/x7mmAbGhew jjaw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=2v6ZDxWJBdPjyVOqXldEzQZbaFfKtrQEkyAYzEdm2bg=; b=Y6lotfVQPew3tCaq3MwQeooZKEVo1D1d6kaAYVy9ES2LhEgSLt8WgN/dO4HDEUP1Qw kqS9yOc3YAwB/viyfxMFUNeAeQ+Y3Z7ly0gfhRIutHEUoiT52EKHod2760XsZHhkpMs5 pyh5QjU/Q0BlOa5rs1DZy/7GWlGEz7l2EPrvPqGc/GImS/99aQxx7VCbon8AvW02BL6K Ozg9W+IMVi1azLnMOikPuZFS6fgAy6CnK21sEGk9yZZBi4/o2imun6iZiPSz3oESoppy w6DhrAofsQPpryNgrGzaHLvWXnph3+raNZquP3FhRUyUryiy49r6JU4LSn4XdljMACzM qarA== ARC-Authentication-Results: i=1; mx.google.com; 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 l11si34401733pgg.554.2019.04.13.00.21.54; Sat, 13 Apr 2019 00:22:10 -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; 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 S1727214AbfDMHUu (ORCPT + 99 others); Sat, 13 Apr 2019 03:20:50 -0400 Received: from www.osadl.org ([62.245.132.105]:36387 "EHLO www.osadl.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727197AbfDMHUu (ORCPT ); Sat, 13 Apr 2019 03:20:50 -0400 Received: from debian01.hofrr.at (178.115.242.59.static.drei.at [178.115.242.59]) by www.osadl.org (8.13.8/8.13.8/OSADL-2007092901) with ESMTP id x3D7JfAW003435; Sat, 13 Apr 2019 09:20:24 +0200 From: Nicholas Mc Guire To: Russell King Cc: Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Mark Brown , Linus Walleij , Tony Lindgren , Mike Rapoport , Janusz Krzysztofik , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Nicholas Mc Guire Subject: [PATCH] ARM: u300: add missing check for kmalloc Date: Sat, 13 Apr 2019 09:14:20 +0200 Message-Id: <1555139666-948-9-git-send-email-hofrat@osadl.org> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1555139666-948-1-git-send-email-hofrat@osadl.org> References: <1555139666-948-1-git-send-email-hofrat@osadl.org> X-Spam-Status: No, score=-1.9 required=6.0 tests=BAYES_00,DATE_IN_FUTURE_96_Q, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on www.osadl.org Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org kmalloc return for bigrxbuf_virtual was not being checked - in case of failure set status, cleanup bigtxbuf_virtual and baile out. Signed-off-by: Nicholas Mc Guire Fixes: c7c8c78fdf6e ("ARM: 5667/3: U300 SSP/SPI board setup and test") --- Issue found with experimental coccinelle script Not sure about the checkpatch message: CHECK: Comparison to NULL could be written "!bigrxbuf_virtual" #32: FILE: arch/arm/mach-u300/dummyspichip.c:67: + if (bigrxbuf_virtual == NULL) { As the current check for bigtxbuf_virtual uses == NULL that was retained for consistency here. Patch was compile tested with: u300_defconfig (implies MACH_U300_SPIDUMMY=y) Patch is against 4.18 (localversion-next is next-20180824) arch/arm/mach-u300/dummyspichip.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/arch/arm/mach-u300/dummyspichip.c b/arch/arm/mach-u300/dummyspichip.c index 68fe986..ff293ee 100644 --- a/arch/arm/mach-u300/dummyspichip.c +++ b/arch/arm/mach-u300/dummyspichip.c @@ -62,7 +62,13 @@ static ssize_t dummy_looptest(struct device *dev, status = -ENOMEM; goto out; } + bigrxbuf_virtual = kmalloc(DMA_TEST_SIZE, GFP_KERNEL); + if (bigrxbuf_virtual == NULL) { + kfree(bigtxbuf_virtual); + status = -ENOMEM; + goto out; + } /* Fill TXBUF with some happy pattern */ memset(bigtxbuf_virtual, 0xAA, DMA_TEST_SIZE); -- 2.1.4