Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp2693761img; Sun, 24 Mar 2019 16:20:08 -0700 (PDT) X-Google-Smtp-Source: APXvYqzYy543eoBYT0XVNQMrlReJUtklLYdxOw0+mK0Xu9beKelwnyCQap+Smw1piEr9H4QXNSki X-Received: by 2002:a63:2403:: with SMTP id k3mr20229442pgk.200.1553469607921; Sun, 24 Mar 2019 16:20:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553469607; cv=none; d=google.com; s=arc-20160816; b=piC/RmUSY/WqiRpyVRm5xrG4AA2Vk47wco5Vi+/Iss9+O7Q2mTQ2No/brFEUEwPUPn D2OrxT4vePzFN1j6aqwgGYEz3DR/oVDDjkYWkne3g3nVJW0iACU1tDJatmG2UnNUSpDH O/eRWKZxZ/efFSkwzKlTg9SWTNM0mZbi1F9O1aeaS/z6YTgm9+kcUEebLsXssXAMVjMp Dq5wdOYL85v+4RlIo/fiQvgSDVLlTcbOEMyLJWk3xNfs3H8TVuqNVj37AVT6Kjkhet+N eZldyCRSRQzX28ZhPESHS2tI3QniTP6Mmj2Dyro/WSHUgThCEU/C1WHkSc1v86ZyHU2q HQcQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:subject:cc:to:from:date:references :in-reply-to:message-id:mime-version:user-agent:dkim-signature :dkim-signature; bh=+AtqmXDbkawaUXtI5XQZuTYqeFZTunPgF8mmNQUJkH8=; b=rx2HFm7l+nHhOcwtv/kZDHTvTHJ67mSXRu1iX/R+CDQEADQPCOyfc5x9faVv4FB3O4 h0v/klBFpLwHSQO7RFqtx5hfiQEhA/vmXpAu/kQAwTykqpB6pMm7+MlwwCQnHnMvXwtk 2GoQwcp7/aQFoHWsnrR+XhgP7cic6o6Gap3izt7IMLifeawp5DqjeBMSwmjsS8l52bcu yVan//z5wzKdYID9RtnNxAI/uEgWtvKZcxvzfgILVC8X4NwdM96icGuMSnXyYTxZGpdI ttQS/0xw+TP73+ZMaZHyfz3y0GSPLITTpHgZI5dPyKttcVIte3YUaYGBDAzdjubKG22g Ru5Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@aj.id.au header.s=fm2 header.b=q1dSQv8q; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=RbddL7t6; 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 g64si12330908pfd.234.2019.03.24.16.19.53; Sun, 24 Mar 2019 16:20:07 -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=@aj.id.au header.s=fm2 header.b=q1dSQv8q; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=RbddL7t6; 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 S1729136AbfCXXTN (ORCPT + 99 others); Sun, 24 Mar 2019 19:19:13 -0400 Received: from out3-smtp.messagingengine.com ([66.111.4.27]:57165 "EHLO out3-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729069AbfCXXTN (ORCPT ); Sun, 24 Mar 2019 19:19:13 -0400 X-Greylist: delayed 399 seconds by postgrey-1.27 at vger.kernel.org; Sun, 24 Mar 2019 19:19:12 EDT Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id BA353213CA; Sun, 24 Mar 2019 19:12:32 -0400 (EDT) Received: from imap2 ([10.202.2.52]) by compute4.internal (MEProxy); Sun, 24 Mar 2019 19:12:32 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aj.id.au; h= mime-version:message-id:in-reply-to:references:date:from:to:cc :subject:content-type; s=fm2; bh=+AtqmXDbkawaUXtI5XQZuTYqeFZTunP gF8mmNQUJkH8=; b=q1dSQv8qWhtPNFLm1fLDd1TWk345t7MlmBwINPQAt/rIWdq F+Utjt+euP0VxVqAOZ4JLwq1EfMmuuJ90eqG26Ml/qqYz1zJ69yRU1oB7NXC4u9b gHCIYYSMCz0Xb7E3m2T+MD9cxXeIvO/LR1HTLroOre6s7EV0qFpogNdkQQJvbWyI fep0+G4bzWig4UGSDq4vJqIDdJjWE/rXuc+FwqTlWqCVLflmzSG71bEPtw/HF+mT lSY0V6zkhH3HbJq7ELa9bUeq6+z9lpiBQJH3rWo6jT6qFPGU6G3YtlOapL5qwqWP 7islv7a7Dm4w2gyVFTidqJnQCNjKy/XnoMwp08w== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; bh=+AtqmX DbkawaUXtI5XQZuTYqeFZTunPgF8mmNQUJkH8=; b=RbddL7t6omTBaG4Hnrp3Zh l8K07N4RFgH+AHU3v7uqx/5Gi/aOkOgAC3Q26EVW4oKwchVPglrJpdwlh534evg8 EX/vmKEC1TtqApEoJZ89XZR50lN8Oa9cJcSaQev9ogQXDCS8SFvzP/0i3HZz+JHf tUiSZ8Thn8Je7JoOrjV4f0Q13VMOxpy7iGXDreU9Wm2dkP4hhkF15006NIGwxa3I aLP7E8KKpmUWBx9ZPppGxo+y9r4buGUjGytCJVDrjvHcISFpYVFKTke1Nv+KsfeF IYVDhF0PkDnXIKbqxZ7Lj17ZJUvIRyoubBM5ZAIlnnq5FFpda0Y2NdprEoRdbVTQ == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedutddrjeeigddujeduucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepofgfggfkjghffffhvffutgesthdtredtreertdenucfhrhhomhepfdetnhgu rhgvficulfgvfhhfvghrhidfuceorghnughrvgifsegrjhdrihgurdgruheqnecurfgrrh grmhepmhgrihhlfhhrohhmpegrnhgurhgvfiesrghjrdhiugdrrghunecuvehluhhsthgv rhfuihiivgeptd X-ME-Proxy: Received: by mailuser.nyi.internal (Postfix, from userid 501) id 473F97C63D; Sun, 24 Mar 2019 19:12:31 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.1.5-976-g376b1f3-fmstable-20190314v3 Mime-Version: 1.0 X-Me-Personality: 52947553 Message-Id: In-Reply-To: <20190324231002.2106-1-kjlu@umn.edu> References: <20190324231002.2106-1-kjlu@umn.edu> Date: Sun, 24 Mar 2019 19:12:06 -0400 From: "Andrew Jeffery" To: "Kangjie Lu" Cc: pakki001@umn.edu, "Linus Walleij" , "Bartosz Golaszewski" , "Joel Stanley" , linux-gpio@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-aspeed@lists.ozlabs.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] gpio: fix a potential NULL pointer dereference Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 = > 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 > >