From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750773AbdAXFcJ (ORCPT ); Tue, 24 Jan 2017 00:32:09 -0500 Received: from mail-pg0-f66.google.com ([74.125.83.66]:33751 "EHLO mail-pg0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750703AbdAXFcI (ORCPT ); Tue, 24 Jan 2017 00:32:08 -0500 From: Arvind Yadav To: perex@perex.cz, tiwai@suse.com Cc: alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org Subject: [PATCH v3] ALSA: ymfpci: Handle return NULL error from ioremap_nocache Date: Tue, 24 Jan 2017 11:01:26 +0530 Message-Id: <1485235886-30813-1-git-send-email-arvind.yadav.cs@gmail.com> X-Mailer: git-send-email 1.9.1 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Here, If 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 --- sound/pci/ymfpci/ymfpci_main.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sound/pci/ymfpci/ymfpci_main.c b/sound/pci/ymfpci/ymfpci_main.c index ffee284..8be1f07 100644 --- a/sound/pci/ymfpci/ymfpci_main.c +++ b/sound/pci/ymfpci/ymfpci_main.c @@ -2392,6 +2392,10 @@ int snd_ymfpci_create(struct snd_card *card, chip->rev = pci->revision; chip->reg_area_phys = pci_resource_start(pci, 0); chip->reg_area_virt = ioremap_nocache(chip->reg_area_phys, 0x8000); + if (!chip->reg_area_virt) { + snd_ymfpci_free(chip); + return -ENOMEM; + } pci_set_master(pci); chip->src441_used = -1; -- 1.9.1