Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S941537AbcLVRNB (ORCPT ); Thu, 22 Dec 2016 12:13:01 -0500 Received: from mail-pg0-f65.google.com ([74.125.83.65]:34946 "EHLO mail-pg0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1762052AbcLVRM7 (ORCPT ); Thu, 22 Dec 2016 12:12:59 -0500 Subject: Re: [v1] mmc: host: dw_mmc-pci:- Handle return NULL error from pcim_iomap_table To: jh80.chung@samsung.com, ulf.hansson@linaro.org References: <1482408409-13404-1-git-send-email-arvind.yadav.cs@gmail.com> Cc: linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org From: arvind Yadav Message-ID: <7735ce5d-643a-1e8a-1f13-0ea24cc4b65b@gmail.com> Date: Thu, 22 Dec 2016 22:42:49 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: <1482408409-13404-1-git-send-email-arvind.yadav.cs@gmail.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 838 Lines: 28 Ignore this change. Sorry for noise. Thanks -Arvind On Thursday 22 December 2016 05:36 PM, Arvind Yadav wrote: > Here, If pcim_iomap_table 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/mmc/host/dw_mmc-pci.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/drivers/mmc/host/dw_mmc-pci.c b/drivers/mmc/host/dw_mmc-pci.c > index ab82796..f42d302 100644 > --- a/drivers/mmc/host/dw_mmc-pci.c > +++ b/drivers/mmc/host/dw_mmc-pci.c > @@ -61,6 +61,8 @@ static int dw_mci_pci_probe(struct pci_dev *pdev, > return ret; > > host->regs = pcim_iomap_table(pdev)[PCI_BAR_NO]; > + if (!host->regs) > + return -ENOMEM; > > pci_set_master(pdev); >