From patchwork Wed Jan 18 10:21:51 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arvind Yadav X-Patchwork-Id: 9523083 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 AB0CD60449 for ; Wed, 18 Jan 2017 10:30:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 90295285D1 for ; Wed, 18 Jan 2017 10:30:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 84D95285EB; Wed, 18 Jan 2017 10:30:22 +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=-6.3 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 35EE4285D4 for ; Wed, 18 Jan 2017 10:30:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751434AbdARKaV (ORCPT ); Wed, 18 Jan 2017 05:30:21 -0500 Received: from mail-pf0-f196.google.com ([209.85.192.196]:32988 "EHLO mail-pf0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751668AbdARKaT (ORCPT ); Wed, 18 Jan 2017 05:30:19 -0500 Received: by mail-pf0-f196.google.com with SMTP id e4so883602pfg.0; Wed, 18 Jan 2017 02:30:15 -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=Z9NYXPYKbVjcixvHY4j9G/SaouGhm9PyiDGGvmTdZLI=; b=tDpJYudRgGxapnT6eSuMi1BPb1qstl6bCGH2YeEZ+kxfdG+WFLJy//6GvHLMNyuMKF +ldIHdgq3nCCZ0mQNkN5JqLA5TRvqjU8tGb7E7YmriVB3sHzX/5qKK+8+7inhxVmC8Qa 7OpHS7dV6lXLoyX1asfVRFFdv8FRi1KkwTIyaXKX06zWWiKtuRf2OYH+1hXyyIEv+Exx mn15huOiA4FccSEAi0pwTjIWNq2Bgr746NxP2BexNJWG24bFumCQfM9bhZhaH36Tjj75 D9SJXSGkz9S2Jf2JDqgK1uiJh1WJAd4bQG0ohLOVwjadkCLO1Evq6BuwzZN1QxC9NOBM +ljA== 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=Z9NYXPYKbVjcixvHY4j9G/SaouGhm9PyiDGGvmTdZLI=; b=dQtFRJYolhMnuAQb8cnKWOfYqxdUGg+iBK0BFJs/tACD2vZVZKDWBHDlUYItfiI+dS kUTdgiXT9Lyfmf3/jJczr0sN1H3IMLgrG6FmKvhsHMk03T+QzFDRCi9DrahOTYmxf8rF h01twbHTQjmt837yIqXMG1F0qgjEM8kWFsKa0qQACP66HErjswdfnSGP/JrwhgW7NmaE CFHpLYoVfR5cVPjt6yv4u+FJTqL2/Jng3uQRZGStO6tt3pv5nqszab8spcBjtchTZAJH 08CSyyEWGtOo+nTSj0rlOogcAGX3YEsEdNdPuy0+9CCWFA2P35ZxzwHpyPDNu6MpxDaG cPGw== X-Gm-Message-State: AIkVDXJpd73OcJf+cTvBkSoPTVJ55VasvF+huj2mNpRCrFNT1y9qLze4c5XEIpVw5jcgqw== X-Received: by 10.99.209.85 with SMTP id c21mr3070650pgj.103.1484734944223; Wed, 18 Jan 2017 02:22:24 -0800 (PST) Received: from symbol-HP-Z420-Workstation.zebra.lan ([223.31.70.102]) by smtp.googlemail.com with ESMTPSA id w65sm62547233pfw.9.2017.01.18.02.22.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 18 Jan 2017 02:22:23 -0800 (PST) From: Arvind Yadav To: jejb@parisc-linux.org, deller@gmx.de, b.zolnierkie@samsung.com Cc: linux-parisc@vger.kernel.org, linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v1] video : fbdev : stifb :- Handle return NULL error from ioremap_nocache. Date: Wed, 18 Jan 2017 15:51:51 +0530 Message-Id: <1484734911-5299-1-git-send-email-arvind.yadav.cs@gmail.com> X-Mailer: git-send-email 1.9.1 Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.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 --- drivers/video/fbdev/stifb.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/video/fbdev/stifb.c b/drivers/video/fbdev/stifb.c index accfef7..d5deab3 100644 --- a/drivers/video/fbdev/stifb.c +++ b/drivers/video/fbdev/stifb.c @@ -1294,6 +1294,10 @@ static int __init stifb_init_fb(struct sti_struct *sti, int bpp_pref) strcpy(fix->id, "stifb"); info->fbops = &stifb_ops; info->screen_base = ioremap_nocache(REGION_BASE(fb,1), fix->smem_len); + if (!info->screen_base) { + printk(KERN_ERR "stifb: Failed to Map memory\n"); + goto out_err0; + } info->screen_size = fix->smem_len; info->flags = FBINFO_DEFAULT | FBINFO_HWACCEL_COPYAREA; info->pseudo_palette = &fb->pseudo_palette;