From patchwork Tue Oct 30 15:09:41 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Senna Tschudin X-Patchwork-Id: 1670551 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 9CE00DF264 for ; Tue, 30 Oct 2012 15:10:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756040Ab2J3PJx (ORCPT ); Tue, 30 Oct 2012 11:09:53 -0400 Received: from mail-wi0-f172.google.com ([209.85.212.172]:65215 "EHLO mail-wi0-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755088Ab2J3PJv (ORCPT ); Tue, 30 Oct 2012 11:09:51 -0400 Received: by mail-wi0-f172.google.com with SMTP id hq12so3326622wib.1 for ; Tue, 30 Oct 2012 08:09:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer; bh=3OuNi8AtSKz7hRSCy/ZEtlO9mNZ/t09QFmhWU5ICS0s=; b=LCVMp63+kq0YzzEKCNXRjWJaPmFWbqP25x3RZ+6gJJ4S30qunqEh6kbshFQT9t6vOw snGb2okhL8q0MPg+XH0P5I00HSwgYDK7b9YqVOE1OLTBPLWgj4qQ34yx0ish7qK1HJeO MKNBdo5LppPI2UactEE1375jV5rTcAXH+tm3eYiIP4rgISJgqYdIH9DBca789nUECT0x HW1604EtA4PDJxcvznnYD3gqDXZK2PyuvyCEkjmy0JMvivnbqUZ001cwaTMtdYMae/FQ LhY4n8w1ien2l58v0cPva2Ds0G2lIZnfMynJmOhH7WcHonNQd5XeXPrkOgCwNYGL3SGd uABw== Received: by 10.181.13.194 with SMTP id fa2mr2528949wid.10.1351609790409; Tue, 30 Oct 2012 08:09:50 -0700 (PDT) Received: from ace.home.fr (ppeter.rsr.lip6.fr. [132.227.76.16]) by mx.google.com with ESMTPS id dt9sm14295993wib.1.2012.10.30.08.09.49 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 30 Oct 2012 08:09:49 -0700 (PDT) From: Peter Senna Tschudin To: mchehab@infradead.org Cc: crope@iki.fi, remi.schwartz@gmail.com, kyle@kyle.strickland.name, pinusdtv@hotmail.com, linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Peter Senna Tschudin Subject: [PATCH] drivers/media/pci/saa7134/saa7134-dvb.c: Test if videobuf_dvb_get_frontend return NULL Date: Tue, 30 Oct 2012 16:09:41 +0100 Message-Id: <1351609781-16148-1-git-send-email-peter.senna@gmail.com> X-Mailer: git-send-email 1.7.11.7 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Based on commit: e66131cee501ee720b7b58a4b87073b8fbaaaba6 Not testing videobuf_dvb_get_frontend output may cause OOPS if it return NULL. This patch fixes this issue. The semantic patch that found this issue is(http://coccinelle.lip6.fr/): // @@ identifier i,a,b; statement S, S2; @@ i = videobuf_dvb_get_frontend(...); ... when != if (!i) S * if (i->a.b) S2 // Signed-off-by: Peter Senna Tschudin --- drivers/media/pci/saa7134/saa7134-dvb.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/media/pci/saa7134/saa7134-dvb.c b/drivers/media/pci/saa7134/saa7134-dvb.c index b209de4..27915e5 100644 --- a/drivers/media/pci/saa7134/saa7134-dvb.c +++ b/drivers/media/pci/saa7134/saa7134-dvb.c @@ -607,6 +607,9 @@ static int configure_tda827x_fe(struct saa7134_dev *dev, /* Get the first frontend */ fe0 = videobuf_dvb_get_frontend(&dev->frontends, 1); + if (!fe0) + return -EINVAL; + fe0->dvb.frontend = dvb_attach(tda10046_attach, cdec_conf, &dev->i2c_adap); if (fe0->dvb.frontend) { if (cdec_conf->i2c_gate)