Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1276639

Re: [PATCH] mfd: qcom_rpm: fix a possible NULL dereference

Path csiph.com!eternal-september.org!feeder.eternal-september.org!aioe.org!bofh.it!news.nic.it!robomod
From Lee Jones <lee.jones@linaro.org>
Newsgroups linux.kernel
Subject Re: [PATCH] mfd: qcom_rpm: fix a possible NULL dereference
Date Tue, 24 Nov 2015 17:50:02 +0100
Message-ID <qyoX0-2d3-7@gated-at.bofh.it> (permalink)
References <qtUXw-62X-15@gated-at.bofh.it>
X-Original-To LABBE Corentin <clabbe.montjoie@gmail.com>
Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro-org.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=gdDCf54ktDuHIuCm57kbAE9GJEmuK3uo6WTr/PT+mQY=; b=ZLw1qZYWitlNN80lius7NHHbcBcXLc5InRxiOWu0GuRmHgvjxap6v+87yFGCMX2TlP 8pgGW35l1qB/1uWjaT7Ye3H5kC16q3DQUSQPd/12KsioWMJFuh40vqFoUJwTbn4YH7MZ D3BGtJSq6vnsgUdcBWPttVPHHA9q4q/mglOohc7e1PVlp7OJbaO08ruih8bIrJkT/BgV N4Wggs3Jj033NT4+iBB6Wp/raC5GUbek4WTCF7iBWZeT0LZ2rwGC4HK3ZZKVIUQ1vH38 /hPU25g9Sf7WLuoF3AFcYw/ruRNNLMjaNVELFC7oCJgPSlU6qzWHLDMeyMJl7aExLUmv PGzg==
X-Google-Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-type:content-disposition :content-transfer-encoding:in-reply-to:user-agent; bh=gdDCf54ktDuHIuCm57kbAE9GJEmuK3uo6WTr/PT+mQY=; b=MgO0u1agbZOy+LfgatA72nZiLWxT/43/Dcpk97ubF1p29JrjAQyhQ9oYuAwBDbWxsc tGdFQ+tA+1kLo9VdEPC8Kz4+k7cSpg7aitmqKtDKPuFY4n883cqDaBXp1mUxQetgaJd0 FEOqW+liTQ0vMjsC51H8Rvnr9fJIgyBcBE7XH4H8LAUg14XEm/ApE3+hOyor5Zw0x+9o v6Z56jBOwVeoL2iJ+CtoWibDNaGN5Jo6KLumvlFVsg8JPJHbgrb0p14oCbX/dk5MxkQa NJDn2XYJiQV0VbrAGJPtR7JDZcesUfVb5UYNKDmUFoLDJx3BZc2pjnGTOZqN4XjCHLtk WXww==
X-Gm-Message-State ALoCoQlMTJQszIfsz0mjUrqR69OxbxBDnwT78M2hfZGoTLUGe70Ho4DAtYQRRwlgjaiT+Ql3/hge
X-Received by 10.194.89.170 with SMTP id bp10mr20200670wjb.7.1448383606553; Tue, 24 Nov 2015 08:46:46 -0800 (PST)
MIME-Version 1.0
Content-Type text/plain; charset=utf-8
Content-Disposition inline
Content-Transfer-Encoding 8bit
User-Agent Mutt/1.5.21 (2010-09-15)
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 36
Organization linux.* mail to news gateway
X-Original-Cc linux-kernel@vger.kernel.org
X-Original-Date Tue, 24 Nov 2015 16:46:42 +0000
X-Original-Message-ID <20151124164642.GD12874@x1>
X-Original-References <1447314599-31460-1-git-send-email-clabbe.montjoie@gmail.com>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1276639

Show key headers only | View raw


On Thu, 12 Nov 2015, LABBE Corentin wrote:

> of_match_device could return NULL, and so cause a NULL pointer
> dereference later.
> 
> Signed-off-by: LABBE Corentin <clabbe.montjoie@gmail.com>
> ---
>  drivers/mfd/qcom_rpm.c | 2 ++
>  1 file changed, 2 insertions(+)

Applied, thanks.

> diff --git a/drivers/mfd/qcom_rpm.c b/drivers/mfd/qcom_rpm.c
> index 207a3bd..1be47ad 100644
> --- a/drivers/mfd/qcom_rpm.c
> +++ b/drivers/mfd/qcom_rpm.c
> @@ -495,6 +495,8 @@ static int qcom_rpm_probe(struct platform_device *pdev)
>  	}
>  
>  	match = of_match_device(qcom_rpm_of_match, &pdev->dev);
> +	if (!match)
> +		return -ENODEV;
>  	rpm->data = match->data;
>  
>  	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | Next | Find similar | Unroll thread


Thread

Re: [PATCH] mfd: qcom_rpm: fix a possible NULL dereference Lee Jones <lee.jones@linaro.org> - 2015-11-24 17:50 +0100

csiph-web