From patchwork Tue May 20 21:35:59 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rickard Strandqvist X-Patchwork-Id: 4213151 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 D2D8B9F1CD for ; Tue, 20 May 2014 21:35:14 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1D234201D5 for ; Tue, 20 May 2014 21:35:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 46F89201DD for ; Tue, 20 May 2014 21:35:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750841AbaETVfM (ORCPT ); Tue, 20 May 2014 17:35:12 -0400 Received: from mail-ee0-f41.google.com ([74.125.83.41]:39617 "EHLO mail-ee0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750763AbaETVfL (ORCPT ); Tue, 20 May 2014 17:35:11 -0400 Received: by mail-ee0-f41.google.com with SMTP id t10so989216eei.28 for ; Tue, 20 May 2014 14:35:09 -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=FsXO9pUDrgnkIx5wlJT3piIT7iW+zpVc6Bqf5C0+QdE=; b=EW+KAk64Py351xtZocPFCII4boJGHfj5xV2qAJEG+cvu+3ocxgq9333EWkX8AYmCyl iIvsFp9W0XgZ/RJNor0z+W/jUNX0cCgeNPhKhJyOlPCO5aulndM6LkRtHZDNhDSzFBnb 6M6Thdpotjsg3wNhIYdcK6unwRtU1rJTxaBiAqQjvBz67lQuC/i7Z+S3/RSzPKT+n4B1 nWIsswlwiUSQs8LrnIa7msQfdW6yCxZHZp6LUT02poMdgy9ndQbXWRGVn8vOnN6nLPsL U0stQw13y353NhoFm//PjwoKt6S0kig2s8AlSqow6Ew96U6x8mZW/BgdiYeKJzLE/z9V dQsQ== X-Gm-Message-State: ALoCoQnpolV+Cyoyw0POCCKqYY3h8J44gh58Hn1G3nZJNcDFBaIIKuVb/Ib806dNA2uw/ZHxgs7P X-Received: by 10.14.206.137 with SMTP id l9mr7743469eeo.40.1400621709858; Tue, 20 May 2014 14:35:09 -0700 (PDT) Received: from localhost.localdomain (h-245-62.a218.priv.bahnhof.se. [85.24.245.62]) by mx.google.com with ESMTPSA id f3sm6711605eep.40.2014.05.20.14.35.08 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 20 May 2014 14:35:08 -0700 (PDT) From: Rickard Strandqvist To: Jean-Christophe Plagniol-Villard , Tomi Valkeinen Cc: Rickard Strandqvist , Grant Likely , Rob Herring , Sachin Kamat , Jingoo Han , Daniel Vetter , linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org Subject: [PATCH] video: fbdev: grvga.c: Fix for possible null pointer dereference Date: Tue, 20 May 2014 23:35:59 +0200 Message-Id: <1400621759-7814-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/grvga.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/video/fbdev/grvga.c b/drivers/video/fbdev/grvga.c index c078701..2db5bb1 100644 --- a/drivers/video/fbdev/grvga.c +++ b/drivers/video/fbdev/grvga.c @@ -514,9 +514,10 @@ free_fb: static int grvga_remove(struct platform_device *device) { struct fb_info *info = dev_get_drvdata(&device->dev); - struct grvga_par *par = info->par; + struct grvga_par *par; if (info) { + par = info->par; unregister_framebuffer(info); fb_dealloc_cmap(&info->cmap);