From patchwork Tue May 20 21:37:32 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rickard Strandqvist X-Patchwork-Id: 4213171 Return-Path: X-Original-To: patchwork-linux-fbdev@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id C682E9F1CD for ; Tue, 20 May 2014 21:36:46 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 15E662012B for ; Tue, 20 May 2014 21:36:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3D9082011D for ; Tue, 20 May 2014 21:36:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750942AbaETVgo (ORCPT ); Tue, 20 May 2014 17:36:44 -0400 Received: from mail-ee0-f41.google.com ([74.125.83.41]:56153 "EHLO mail-ee0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750832AbaETVgn (ORCPT ); Tue, 20 May 2014 17:36:43 -0400 Received: by mail-ee0-f41.google.com with SMTP id t10so960936eei.0 for ; Tue, 20 May 2014 14:36:42 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=+mhixpl11s1tu/983hUXWJpWWQFwExulyjIF5gm//z4=; b=IhRj6vOZkNV22hxU1PFAmwoIgekPD8aZUJ+2QfzvoctTuMGzD3ktfonNkl5+K62ckT rdl3hlwQyCSX3ZyjBTAMiDU4ulyQt32K8qnj63hw7Npq9YmJCKXleI90WGFdyQ2+bCFW zTuZRcV7y9ktdnLpwhONwFK5x/lnzKFaqrFzwLlCzqcTU78rOBna5ltjwu69Mg/0XndW IyIHEs1VrsW9712N1Fmmrto0AY5lkpMNLulLJXba1Vx2v+vpz2NgustSdfLXkOOxX9xU wSodfh8L8iswv0dmfkzUf0DugTLDj7522pybt+YwhXYM7s8a24CsKBCyoh5Y9RNmBuJ3 0wGw== X-Gm-Message-State: ALoCoQkfadncKcRUHZdHenGO+dS4kBAqBp62tdQLmWAK7kgHsqw+8t3YQKPVUB7VchCY4dB+EWTX X-Received: by 10.14.213.193 with SMTP id a41mr7515052eep.68.1400621802827; Tue, 20 May 2014 14:36:42 -0700 (PDT) Received: from localhost.localdomain (h-245-62.a218.priv.bahnhof.se. [85.24.245.62]) by mx.google.com with ESMTPSA id x45sm6732327eeu.23.2014.05.20.14.36.41 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 20 May 2014 14:36:42 -0700 (PDT) From: Rickard Strandqvist To: Jean-Christophe Plagniol-Villard , Tomi Valkeinen Cc: Rickard Strandqvist , Jingoo Han , Daniel Vetter , Wei Yongjun , Bjorn Helgaas , Joe Perches , linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] video: fbdev: s3fb.c: Fix for possible null pointer dereference Date: Tue, 20 May 2014 23:37:32 +0200 Message-Id: <1400621852-7886-1-git-send-email-rickard_strandqvist@spectrumdigital.se> X-Mailer: git-send-email 1.7.10.4 Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP There is otherwise a risk of a possible null pointer dereference. Was largely found by using a static code analysis program called cppcheck. Signed-off-by: Rickard Strandqvist --- drivers/video/fbdev/s3fb.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/video/fbdev/s3fb.c b/drivers/video/fbdev/s3fb.c index 9a3f8f1..c43b969 100644 --- a/drivers/video/fbdev/s3fb.c +++ b/drivers/video/fbdev/s3fb.c @@ -1401,9 +1401,10 @@ err_enable_device: static void s3_pci_remove(struct pci_dev *dev) { struct fb_info *info = pci_get_drvdata(dev); - struct s3fb_info __maybe_unused *par = info->par; + struct s3fb_info __maybe_unused *par; if (info) { + par = info->par; #ifdef CONFIG_MTRR if (par->mtrr_reg >= 0) {