From patchwork Tue Mar 23 06:22:47 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julia Lawall X-Patchwork-Id: 2998 Return-path: Envelope-to: mchehab@infradead.org Delivery-date: Tue, 23 Mar 2010 06:23:20 +0000 Received: from bombadil.infradead.org [18.85.46.34] by pedra with IMAP (fetchmail-6.3.6) for (single-drop); Tue, 23 Mar 2010 03:29:24 -0300 (BRT) Received: from vger.kernel.org ([209.132.180.67]) by bombadil.infradead.org with esmtp (Exim 4.69 #1 (Red Hat Linux)) id 1NtxWK-0006bS-8Z; Tue, 23 Mar 2010 06:23:20 +0000 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753720Ab0CWGWy (ORCPT + 1 other); Tue, 23 Mar 2010 02:22:54 -0400 Received: from mgw1.diku.dk ([130.225.96.91]:52960 "EHLO mgw1.diku.dk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750824Ab0CWGWx (ORCPT ); Tue, 23 Mar 2010 02:22:53 -0400 Received: from localhost (localhost [127.0.0.1]) by mgw1.diku.dk (Postfix) with ESMTP id 30C2552C4F4; Tue, 23 Mar 2010 07:22:52 +0100 (CET) X-Virus-Scanned: amavisd-new at diku.dk Received: from mgw1.diku.dk ([127.0.0.1]) by localhost (mgw1.diku.dk [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 7tX73Wqh1zYl; Tue, 23 Mar 2010 07:22:47 +0100 (CET) Received: from nhugin.diku.dk (nhugin.diku.dk [130.225.96.140]) by mgw1.diku.dk (Postfix) with ESMTP id C95EF52C48F; Tue, 23 Mar 2010 07:22:47 +0100 (CET) Received: from ask.diku.dk (ask.diku.dk [130.225.96.225]) by nhugin.diku.dk (Postfix) with ESMTP id 8652D6DFB75; Tue, 23 Mar 2010 07:16:46 +0100 (CET) Received: by ask.diku.dk (Postfix, from userid 3767) id A8E55200B0; Tue, 23 Mar 2010 07:22:47 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by ask.diku.dk (Postfix) with ESMTP id 9DFFA200AF; Tue, 23 Mar 2010 07:22:47 +0100 (CET) Date: Tue, 23 Mar 2010 07:22:47 +0100 (CET) From: Julia Lawall To: Andrew Morton Cc: Mark McClelland , Mauro Carvalho Chehab , linux-usb@vger.kernel.org, linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: Re: [PATCH] drivers/media/video: avoid NULL dereference In-Reply-To: <20100322231441.b7e33bf9.akpm@linux-foundation.org> Message-ID: References: <20100322231441.b7e33bf9.akpm@linux-foundation.org> MIME-Version: 1.0 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org From: Julia Lawall It seems impossible for ov to be NULL at this point. The semantic match that finds the problem is as follows: (http://coccinelle.lip6.fr/) // @r exists@ expression E, E1; identifier f; statement S1,S3; iterator iter; @@ if ((E == NULL && ...) || ...) { ... when != false ((E == NULL && ...) || ...) when != true ((E != NULL && ...) || ...) when != iter(E,...) S1 when != E = E1 ( sizeof(E->f) | * E->f ) ... when any return ...; } else S3 // Signed-off-by: Julia Lawall --- drivers/media/video/ov511.c | 5 ----- 1 files changed, 0 insertions(+), 5 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/media/video/ov511.c b/drivers/media/video/ov511.c index e0bce8d..dd1b1ac 100644 --- a/drivers/media/video/ov511.c +++ b/drivers/media/video/ov511.c @@ -5916,11 +5916,6 @@ ov51x_disconnect(struct usb_interface *intf) mutex_lock(&ov->lock); usb_set_intfdata (intf, NULL); - if (!ov) { - mutex_unlock(&ov->lock); - return; - } - /* Free device number */ ov511_devused &= ~(1 << ov->nr);