From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.1 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1E845C43381 for ; Sat, 9 Mar 2019 18:32:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D941C2081B for ; Sat, 9 Mar 2019 18:32:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1552156337; bh=6lPZlMTvvri4ScMoHSfcP+yxbIS9i4YA7ALgI779Fn0=; h=Date:From:To:Cc:Subject:In-Reply-To:References:List-ID:From; b=gF2fSLgY0zTDOL4mPDqfiEHz1XK0x1JOO1FhsJHn2vGmJ1iNYci/yt4kHqGAdvLeT VqnNBVAF2lEDEGHtdXNcDFFUD23/CkloU+wr/MRxY+lQnCPH45LpOJC8BEga0uToRK R89vVFEWcXlfWoKi45g7rT8cKJgaWWYsjZrsdvSU= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726612AbfCIScP (ORCPT ); Sat, 9 Mar 2019 13:32:15 -0500 Received: from mail.kernel.org ([198.145.29.99]:50070 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726348AbfCIScO (ORCPT ); Sat, 9 Mar 2019 13:32:14 -0500 Received: from archlinux (cpc91196-cmbg18-2-0-cust659.5-4.cable.virginm.net [81.96.234.148]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 47C40207E0; Sat, 9 Mar 2019 18:32:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1552156334; bh=6lPZlMTvvri4ScMoHSfcP+yxbIS9i4YA7ALgI779Fn0=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=HQWnHMIpJfmK0sEV1+od5GAII9LkllxxeWL/0FhrGqzcSZ8YBaziZ07n2pY38BHKq Dx7a5YB9IIbNLV/6xU/0xlOZfh0nkhZo5whWtg3dJtKW8SaDQ8jV8lykDalvKqLMkb ZvUjA9TZASBOZ0I0oKstc1o1G1Cr1YY0T+m3R7Ps= Date: Sat, 9 Mar 2019 18:32:07 +0000 From: Jonathan Cameron To: Kangjie Lu Cc: pakki001@umn.edu, Hartmut Knaack , Lars-Peter Clausen , Peter Meerwald-Stadler , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , linux-iio@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] iio: adc: fix a potential NULL pointer dereference Message-ID: <20190309183207.42b68d90@archlinux> In-Reply-To: <20190309045356.8892-1-kjlu@umn.edu> References: <20190309045356.8892-1-kjlu@umn.edu> X-Mailer: Claws Mail 3.17.3 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 8 Mar 2019 22:53:55 -0600 Kangjie Lu wrote: > devm_iio_trigger_alloc may fail and return NULL. The fix returns > ENOMEM when it fails. > > Signed-off-by: Kangjie Lu Seems obviously correct to me. As it's been there a 'while' I'm not going to rush it in however. This can wait for the next merge window. Applied to the togreg branch of iio.git and pushed out as testing for the autobuilders to play with it. Thanks, Jonathan > --- > drivers/iio/adc/mxs-lradc-adc.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/drivers/iio/adc/mxs-lradc-adc.c b/drivers/iio/adc/mxs-lradc-adc.c > index c627513d9f0f..5384472b6c4d 100644 > --- a/drivers/iio/adc/mxs-lradc-adc.c > +++ b/drivers/iio/adc/mxs-lradc-adc.c > @@ -465,6 +465,8 @@ static int mxs_lradc_adc_trigger_init(struct iio_dev *iio) > > trig = devm_iio_trigger_alloc(&iio->dev, "%s-dev%i", iio->name, > iio->id); > + if (!trig) > + return -ENOMEM; > > trig->dev.parent = adc->dev; > iio_trigger_set_drvdata(trig, iio); From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.0 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_PASS, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A2FE4C43381 for ; Sat, 9 Mar 2019 18:32:26 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 78A812081B for ; Sat, 9 Mar 2019 18:32:26 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="CuwAJvMu"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="HQWnHMIp" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 78A812081B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Subject:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=tliOAZ+97vd4QefK/Qi8vc18/V2U3B8fgYGQwGAGWJc=; b=CuwAJvMu7WIv2T UT02OeS9Y5sOhGHvZ4CSfzhuOZaScB+3JXuIR9+y7tXinidZc1FTxr8K5ojYD/LrpgfYizWm4SacV SDkrIdA6mclGuhAmpLvzlpDBQMoykP4Pv6L9C2UOw2/Eh/aB10FvoqXosj4J2XDzs+Yq/SoPCv5X5 tQsTswPDQE4cCYTsbDPuK0xiCyXNTF4oMm4dD+yNHZiTTHBoIGmz6yyVN6+wJoR2sDE12Knbo5nND b/Ptbisd5x+EmYCmevdkgdreFUHUM8co8bEmNG7lXD0gwis3/fi5FbJiFxh4h+ow/FQH8qimGP4GW dWXqjlQx3WrgMBJ1dkVA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1h2glg-0008RT-SI; Sat, 09 Mar 2019 18:32:20 +0000 Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1h2gld-0008Qi-4p for linux-arm-kernel@lists.infradead.org; Sat, 09 Mar 2019 18:32:18 +0000 Received: from archlinux (cpc91196-cmbg18-2-0-cust659.5-4.cable.virginm.net [81.96.234.148]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 47C40207E0; Sat, 9 Mar 2019 18:32:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1552156334; bh=6lPZlMTvvri4ScMoHSfcP+yxbIS9i4YA7ALgI779Fn0=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=HQWnHMIpJfmK0sEV1+od5GAII9LkllxxeWL/0FhrGqzcSZ8YBaziZ07n2pY38BHKq Dx7a5YB9IIbNLV/6xU/0xlOZfh0nkhZo5whWtg3dJtKW8SaDQ8jV8lykDalvKqLMkb ZvUjA9TZASBOZ0I0oKstc1o1G1Cr1YY0T+m3R7Ps= Date: Sat, 9 Mar 2019 18:32:07 +0000 From: Jonathan Cameron To: Kangjie Lu Subject: Re: [PATCH] iio: adc: fix a potential NULL pointer dereference Message-ID: <20190309183207.42b68d90@archlinux> In-Reply-To: <20190309045356.8892-1-kjlu@umn.edu> References: <20190309045356.8892-1-kjlu@umn.edu> X-Mailer: Claws Mail 3.17.3 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190309_103217_201916_9ED61575 X-CRM114-Status: GOOD ( 13.29 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Lars-Peter Clausen , Pengutronix Kernel Team , linux-iio@vger.kernel.org, Fabio Estevam , Sascha Hauer , pakki001@umn.edu, linux-kernel@vger.kernel.org, NXP Linux Team , Peter Meerwald-Stadler , Hartmut Knaack , Shawn Guo , linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Fri, 8 Mar 2019 22:53:55 -0600 Kangjie Lu wrote: > devm_iio_trigger_alloc may fail and return NULL. The fix returns > ENOMEM when it fails. > > Signed-off-by: Kangjie Lu Seems obviously correct to me. As it's been there a 'while' I'm not going to rush it in however. This can wait for the next merge window. Applied to the togreg branch of iio.git and pushed out as testing for the autobuilders to play with it. Thanks, Jonathan > --- > drivers/iio/adc/mxs-lradc-adc.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/drivers/iio/adc/mxs-lradc-adc.c b/drivers/iio/adc/mxs-lradc-adc.c > index c627513d9f0f..5384472b6c4d 100644 > --- a/drivers/iio/adc/mxs-lradc-adc.c > +++ b/drivers/iio/adc/mxs-lradc-adc.c > @@ -465,6 +465,8 @@ static int mxs_lradc_adc_trigger_init(struct iio_dev *iio) > > trig = devm_iio_trigger_alloc(&iio->dev, "%s-dev%i", iio->name, > iio->id); > + if (!trig) > + return -ENOMEM; > > trig->dev.parent = adc->dev; > iio_trigger_set_drvdata(trig, iio); _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel