From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759564AbdADKWx convert rfc822-to-8bit (ORCPT ); Wed, 4 Jan 2017 05:22:53 -0500 Received: from mx07-00178001.pphosted.com ([62.209.51.94]:47986 "EHLO mx07-00178001.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751408AbdADKWt (ORCPT ); Wed, 4 Jan 2017 05:22:49 -0500 From: Vincent ABRIOU To: Arvind Yadav , "benjamin.gaignard@linaro.org" , "airlied@linux.ie" CC: "dri-devel@lists.freedesktop.org" , "linux-kernel@vger.kernel.org" Subject: Re: [v1] gpu: drm: sti: sti_vtg:- Handle return NULL error from devm_ioremap_nocache Thread-Topic: [v1] gpu: drm: sti: sti_vtg:- Handle return NULL error from devm_ioremap_nocache Thread-Index: AQHSW0tXUlPQcUIN2ka0Dii+GvDflKEoEreA Date: Wed, 4 Jan 2017 09:29:24 +0000 Message-ID: <96f01b40-fb46-291b-7395-f95fef88be94@st.com> References: <1482298212-4760-1-git-send-email-arvind.yadav.cs@gmail.com> In-Reply-To: <1482298212-4760-1-git-send-email-arvind.yadav.cs@gmail.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: user-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.5.1 x-ms-exchange-messagesentrepresentingtype: 1 x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [10.75.127.46] Content-Type: text/plain; charset="Windows-1252" Content-ID: <8F431C3A0043B343ACA1FC0DA01681E8@st.com> Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-01-04_07:,, signatures=0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Thanks for the patch. Acked-by: Vincent Abriou I will take it for pull request that should be issued by the end of the week. Vincent On 12/21/2016 06:30 AM, Arvind Yadav wrote: > Here, If devm_ioremap_nocache will fail. It will return NULL. > Kernel can run into a NULL-pointer dereference. This error check > will avoid NULL pointer dereference. > > Signed-off-by: Arvind Yadav > --- > drivers/gpu/drm/sti/sti_vtg.c | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/drivers/gpu/drm/sti/sti_vtg.c b/drivers/gpu/drm/sti/sti_vtg.c > index a8882bd..c3d9c8a 100644 > --- a/drivers/gpu/drm/sti/sti_vtg.c > +++ b/drivers/gpu/drm/sti/sti_vtg.c > @@ -429,6 +429,10 @@ static int vtg_probe(struct platform_device *pdev) > return -ENOMEM; > } > vtg->regs = devm_ioremap_nocache(dev, res->start, resource_size(res)); > + if (!vtg->regs) { > + DRM_ERROR("failed to remap I/O memory\n"); > + return -ENOMEM; > + } > > np = of_parse_phandle(pdev->dev.of_node, "st,slave", 0); > if (np) { >