From patchwork Mon Jan 23 07:36:28 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arvind Yadav X-Patchwork-Id: 9531953 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id A6654604A0 for ; Mon, 23 Jan 2017 09:20:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9C5981FE82 for ; Mon, 23 Jan 2017 09:20:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 912B927CF3; Mon, 23 Jan 2017 09:20:24 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.3 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=no version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3CB001FE82 for ; Mon, 23 Jan 2017 09:20:22 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 5CEF9266AC4; Mon, 23 Jan 2017 10:20:18 +0100 (CET) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id F0EB82668DC; Mon, 23 Jan 2017 10:17:59 +0100 (CET) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id AC4A32667E0; Mon, 23 Jan 2017 08:37:10 +0100 (CET) Received: from mail-pg0-f67.google.com (mail-pg0-f67.google.com [74.125.83.67]) by alsa0.perex.cz (Postfix) with ESMTP id 16E2B265142 for ; Mon, 23 Jan 2017 08:37:08 +0100 (CET) Received: by mail-pg0-f67.google.com with SMTP id t6so13051034pgt.1 for ; Sun, 22 Jan 2017 23:37:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=n6Xa9hEqmM5sCLQGEng/Tp9y9gUZj5rQDKNnaSTPhbo=; b=VeRWdlFe36M3tagRAKn69Gvv7pnqSgNZRIv9WtLs3rvYslbTz76CWFp8VNpHX6FCHv JS3+jGHrjfsS80JZtO07usQF1d1jCGYzkp8gvhDM+PC2gHBzYy4uiV66sxBYy0oFX6im iXPutb4x66QIVyomaaaCSbd53T04sW2XdplizewrgYVTMhrz/bJTxBejAacd37PpOYcp NjSWtSfVzcJ10ovfzKSfiF2ypm3AG74lpEa46tAxvD7jUtuRQTKvH4te5MLAfHQJLoES Q5orgHqhlEUklyhUOZJl1WQBom71EF8pL5USzIV1als62IJkm3aZ6GFVm0nA1LV29eZR NFvw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=n6Xa9hEqmM5sCLQGEng/Tp9y9gUZj5rQDKNnaSTPhbo=; b=TRNaaZdQqb+R5bPmmTz8ZGE273n4iKvfxuP2Mish4w1YU8gVFQ2RjTXKjaVYA3qzpU 0CGfn5zD9QGh7SOjeyXKULB9KcGEgtrdqRsHT+T1lLfvYLpFbwkpKjGoZ3JKXouZHDJ6 5Qvs4lyZxU6bl2y6x+Ivr9Z96WawrH/H3cDD97Umg11zycV38AL117lzhklyn9BAxqjm ZKJo9ZqhyPtBNxBEpAsTKvgSdGWMESlP8024rn5BlMTAE8pVrEkouFMTmGfSXFSETsWf uQ0rxjNdKUXgFntDVTKklnV7MdKjKMWsuObOisrbLyDPWQTNSs6c3hjnbWOTlKsFHFnB lrCQ== X-Gm-Message-State: AIkVDXJ/+ST4mpMAxpSPueYkcf/kjlxOzbkzdXv2PhKHqhfjb7+JG3Fc6NAqu6YlcW9WRw== X-Received: by 10.84.218.76 with SMTP id f12mr41405749plm.146.1485157027196; Sun, 22 Jan 2017 23:37:07 -0800 (PST) Received: from symbol-HP-Z420-Workstation.zebra.lan ([223.31.70.102]) by smtp.googlemail.com with ESMTPSA id 18sm34422570pgf.28.2017.01.22.23.37.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 22 Jan 2017 23:37:06 -0800 (PST) From: Arvind Yadav To: perex@perex.cz, tiwai@suse.com Date: Mon, 23 Jan 2017 13:06:28 +0530 Message-Id: <1485156988-24137-1-git-send-email-arvind.yadav.cs@gmail.com> X-Mailer: git-send-email 1.9.1 Cc: alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org Subject: [alsa-devel] [PATCH v2] ALSA: ymfpci: Handle return NULL error from ioremap_nocache X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP 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..8590c3f 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) { + pci_disable_device(pci); + return -ENOMEM; + } pci_set_master(pci); chip->src441_used = -1;