Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1765879AbcLVL6o (ORCPT ); Thu, 22 Dec 2016 06:58:44 -0500 Received: from mail-io0-f193.google.com ([209.85.223.193]:34731 "EHLO mail-io0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751375AbcLVL6m (ORCPT ); Thu, 22 Dec 2016 06:58:42 -0500 From: Arvind Yadav To: mirq-linux@rere.qmqm.pl Cc: linux-kernel@vger.kernel.org Subject: [v1] misc: cb710: core:- Handle return NULL error from pcim_iomap_table Date: Thu, 22 Dec 2016 17:28:30 +0530 Message-Id: <1482407910-13295-1-git-send-email-arvind.yadav.cs@gmail.com> X-Mailer: git-send-email 1.7.9.5 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 705 Lines: 24 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); -- 1.7.9.5