Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S941591AbcLVROI (ORCPT ); Thu, 22 Dec 2016 12:14:08 -0500 Received: from mail-pg0-f67.google.com ([74.125.83.67]:35472 "EHLO mail-pg0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752619AbcLVROG (ORCPT ); Thu, 22 Dec 2016 12:14:06 -0500 Subject: Re: [v1] misc: cb710: core:- Handle return NULL error from pcim_iomap_table To: mirq-linux@rere.qmqm.pl References: <1482407910-13295-1-git-send-email-arvind.yadav.cs@gmail.com> Cc: linux-kernel@vger.kernel.org From: arvind Yadav Message-ID: Date: Thu, 22 Dec 2016 22:44:03 +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: <1482407910-13295-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: 860 Lines: 29 Ignore this change. Sorry for the noise. Thanks Arvind On Thursday 22 December 2016 05:28 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/misc/cb710/core.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/drivers/misc/cb710/core.c b/drivers/misc/cb710/core.c > index fb397e7..7b60019 100644 > --- a/drivers/misc/cb710/core.c > +++ b/drivers/misc/cb710/core.c > @@ -248,6 +248,8 @@ static int cb710_probe(struct pci_dev *pdev, > spin_lock_init(&chip->irq_lock); > chip->pdev = pdev; > chip->iobase = pcim_iomap_table(pdev)[0]; > + if (!chip->iobase) > + return -ENOMEM; > > pci_set_drvdata(pdev, chip); >