From patchwork Thu Jan 29 18:48:08 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rickard Strandqvist X-Patchwork-Id: 5744621 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id BEFF0BF440 for ; Thu, 29 Jan 2015 18:44:54 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5B2DB2024F for ; Thu, 29 Jan 2015 18:44:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 69C172022D for ; Thu, 29 Jan 2015 18:44:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756874AbbA2Sou (ORCPT ); Thu, 29 Jan 2015 13:44:50 -0500 Received: from mail-lb0-f182.google.com ([209.85.217.182]:57374 "EHLO mail-lb0-f182.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752721AbbA2Sot (ORCPT ); Thu, 29 Jan 2015 13:44:49 -0500 Received: by mail-lb0-f182.google.com with SMTP id l4so31336934lbv.13 for ; Thu, 29 Jan 2015 10:44:48 -0800 (PST) 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=o5xlo078b6EMYuc+R2g6YArWPr4uEfckCp5qJmCMXic=; b=K4av/cr0APjKNZHSSm3qgFCX5OTD56xeUvCfnKJUMZYhp5kSGRvy4D3Kmq27bQktds TloOeiDZyvfMyL8sujDthJGlKYL61/JxAy8z+CRIwW9eaVIYb3nghmI1IJerkuEM/NJ3 vGFi5VSWH9Pt9HP2JwGqs4aBM8aB2s1UvJOLniaAtjpuptrriE9RTE/gwO7UUo2KFYOE 728uzOh7wDhxtaZk6ek6gaTCvCcpaTBSUlDFP3dDlGVc0z6Nair1z0l337YMRxuWTgCo ELcPM05jq9VsZrqH8c7OfwJ4+ShNLQ8mI6m/Hqoz8bQc9h3KyOc7NpabxJsbCwBUiKyr uJ1w== X-Gm-Message-State: ALoCoQndB4bwR+FygZ8NP+rLPcA69m0+sOdWIFnlEQNLqpVF7d4gFNiLHa1PAkjlMZH25UONnC/W X-Received: by 10.112.44.230 with SMTP id h6mr2620797lbm.98.1422557088264; Thu, 29 Jan 2015 10:44:48 -0800 (PST) Received: from localhost.localdomain (h-246-111.a218.priv.bahnhof.se. [85.24.246.111]) by mx.google.com with ESMTPSA id g5sm2263706lag.11.2015.01.29.10.44.46 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 29 Jan 2015 10:44:47 -0800 (PST) From: Rickard Strandqvist To: Jarod Wilson , Mauro Carvalho Chehab Cc: Rickard Strandqvist , Greg Kroah-Hartman , Aya Mahfouz , Gulsah Kose , Tuomas Tynkkynen , Martin Kaiser , linux-media@vger.kernel.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Subject: [PATCH] staging: media: lirc: lirc_zilog: Fix for possible null pointer dereference Date: Thu, 29 Jan 2015 19:48:08 +0100 Message-Id: <1422557288-3617-1-git-send-email-rickard_strandqvist@spectrumdigital.se> X-Mailer: git-send-email 1.7.10.4 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable 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 Fix a possible null pointer dereference, there is otherwise a risk of a possible null pointer dereference. This was found using a static code analysis program called cppcheck Signed-off-by: Rickard Strandqvist --- drivers/staging/media/lirc/lirc_zilog.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/staging/media/lirc/lirc_zilog.c b/drivers/staging/media/lirc/lirc_zilog.c index cc872fb..78ce3b0 100644 --- a/drivers/staging/media/lirc/lirc_zilog.c +++ b/drivers/staging/media/lirc/lirc_zilog.c @@ -1332,10 +1332,8 @@ static int close(struct inode *node, struct file *filep) /* find our IR struct */ struct IR *ir = filep->private_data; - if (ir == NULL) { - dev_err(ir->l.dev, "close: no private_data attached to the file!\n"); + if (ir == NULL) return -ENODEV; - } atomic_dec(&ir->open_count);