Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp3001907img; Mon, 25 Mar 2019 01:29:57 -0700 (PDT) X-Google-Smtp-Source: APXvYqzwDR7jF+8ZwBfxNNAaclevUMmJ6ralVw+uGdrq+EpKbnlCEkT0fLqo2dconrm3hBESvqIS X-Received: by 2002:a17:902:9306:: with SMTP id bc6mr23284266plb.59.1553502597671; Mon, 25 Mar 2019 01:29:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553502597; cv=none; d=google.com; s=arc-20160816; b=U1nVIKzePpv+j8nYaFEA43WmHbt+kE0/dkDfwl+a4EPCdLbIQD0Nx+Fk0TM6BtTENc BXQeUxk9pW6+6ezwP9zvSO5IMYl6/5JHOcunwfO4MRTMWq1BTnlLJ4pPFMXsz7Gsskef 360tNJNmctk2XJWbdZAqj4xd22qGfyC2hDncdfJ6yehzFrrvNNvqzmCr34nXBcvjfl+M W3QkJrzj3aKQQxtmeT3/U4kapdzAHA2gQGXUdJrjQPR5xl38wniW1SHAYfLiHF7Fm+ds ws3DI5RuNU5kxZIu8nPhMWDLLpXkeokVre2I+xP5TWlmdoFnY9g4IFk6wUxESgW7Pq7w WtkA== 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:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=ecGgX+LbPvNCaAYSs9hBPUcbOvj8ceUZoKLvcir46Cc=; b=zEhekqeQ144NsXz/601/qvAwqUyapTK8eXDObMNbIwX0oFXYmdCkO+QfmfXvIABuAO FQur/EdPTZC1AypEhfH7Z01HRR6aPrfUM9M03MYSkvfPWvn2wMHv6LFdwlqeSvquTV9w izuqmIRHG9LiBE2tMN3w3QXQXCYil1gM1Zhj6oy7brE4yzK2Nu9lzdKKOp0LMn/4TrrP PapCFbowHg6Hf6iMo+uMR0jqB9hYmQC6PXTn86A7YkZL/9uKeBL1Qqbr4XiaFumyTMYz DTgtXnoi19l8f6SU6D5zMpj4KCyqUYPCZTdPETNEsnaldAcI7MQPAHEy2IkV8aq9v79x ADZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=JekMKGsD; 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 j5si13021180pfi.227.2019.03.25.01.29.43; Mon, 25 Mar 2019 01:29:57 -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=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=JekMKGsD; 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 S1730053AbfCYI2z (ORCPT + 99 others); Mon, 25 Mar 2019 04:28:55 -0400 Received: from mail-oi1-f194.google.com ([209.85.167.194]:43736 "EHLO mail-oi1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729996AbfCYI2z (ORCPT ); Mon, 25 Mar 2019 04:28:55 -0400 Received: by mail-oi1-f194.google.com with SMTP id 67so6232354oif.10 for ; Mon, 25 Mar 2019 01:28:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=ecGgX+LbPvNCaAYSs9hBPUcbOvj8ceUZoKLvcir46Cc=; b=JekMKGsDKBnwF7R557EwpWL6K0Cy7hNriZlc2wQr5holrXMm+uB2b37fYcyERgYLY8 u7/xcN0xM30WET2e2csQn2+ctnyM+x9XeqiQorkC1HZ2aL0QRN1tXko4ec1uKevio5CT ObdxbrLDVjDqbFX68G/BySoxDAaJPTxiybLrLFRuaLj8voKHFGUc2fuNjwGkK4Dh/e0R HMfE8xc8MOSsiLJNp6aDem4a5tku1/N3rZ6cobjN0aB3wX73Vdd5kVc0iw5arnArUOrp WUh7gK9O564ZfzI0OI+n9x5X9adO61zI3l5gpTK1wE7KiMCxtQOWyOQTVWHddrMev3SI RJDg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=ecGgX+LbPvNCaAYSs9hBPUcbOvj8ceUZoKLvcir46Cc=; b=ZZlAu5+xg8mg6qv43tiRAibLiZjp1sx8UcwI9UIY33RwlnbQi5rp6+OLIN56w4llOO XfwR55U10iQ9p8tgZgenRFWYimPPRb6/hD1Nc8C39XBkK+ip2ThB2Zoa8VPYTc+o/3VP 8r57jslcgK8sTygdibl+gVMQbE53T7+Bl6+PdF2tI0JZCZ9dmb8/agLtdqGGOkuUJso6 OlAUTMDpVU/EDudyJXfEktHifr/G7SE73+x7rucKs+hWt7i4RWU13H33JXmuGedRm9z8 9mEitsha80f1syqE24cDEGIUvrMB3/mkwpQDY+U+l+SClMt2hjP83PM92RPgFjQOjt47 Jb+Q== X-Gm-Message-State: APjAAAWm30UeOlWGBiyC5UZP8NA1YNmvB6taSGCP86Tvnv6TzrLaXjSi G768DlO8iacCle8c1+qPKS9Z9uEC9cCVb/YSvg39lA== X-Received: by 2002:aca:4b03:: with SMTP id y3mr10895187oia.21.1553502534785; Mon, 25 Mar 2019 01:28:54 -0700 (PDT) MIME-Version: 1.0 References: <20190324231002.2106-1-kjlu@umn.edu> In-Reply-To: From: Bartosz Golaszewski Date: Mon, 25 Mar 2019 09:28:43 +0100 Message-ID: Subject: Re: [PATCH] gpio: fix a potential NULL pointer dereference To: Andrew Jeffery Cc: Kangjie Lu , pakki001@umn.edu, Linus Walleij , Joel Stanley , linux-gpio , arm-soc , linux-aspeed@lists.ozlabs.org, LKML Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org pon., 25 mar 2019 o 00:12 Andrew Jeffery napisa=C5=82(a): > > > > On Mon, 25 Mar 2019, at 09:40, Kangjie Lu wrote: > > In case devm_kzalloc, the patch returns ENOMEM to avoid potential > > NULL pointer dereference. > > > > Signed-off-by: Kangjie Lu > > Reviewed-by: Andrew Jeffery > > > --- > > drivers/gpio/gpio-aspeed.c | 2 ++ > > 1 file changed, 2 insertions(+) > > > > diff --git a/drivers/gpio/gpio-aspeed.c b/drivers/gpio/gpio-aspeed.c > > index 854bce4fb9e7..217507002dbc 100644 > > --- a/drivers/gpio/gpio-aspeed.c > > +++ b/drivers/gpio/gpio-aspeed.c > > @@ -1224,6 +1224,8 @@ static int __init aspeed_gpio_probe(struct > > platform_device *pdev) > > > > gpio->offset_timer =3D > > devm_kzalloc(&pdev->dev, gpio->chip.ngpio, GFP_KERNEL); > > + if (!gpio->offset_timer) > > + return -ENOMEM; > > > > return aspeed_gpio_setup_irqs(gpio, pdev); > > } > > -- > > 2.17.1 > > > > Applied to fixes. Bart