From patchwork Wed Jun 3 02:01:04 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Figo.zhang" X-Patchwork-Id: 27597 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n5329mRQ026407 for ; Wed, 3 Jun 2009 02:09:48 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752163AbZFCCJl (ORCPT ); Tue, 2 Jun 2009 22:09:41 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752228AbZFCCJl (ORCPT ); Tue, 2 Jun 2009 22:09:41 -0400 Received: from mail-px0-f182.google.com ([209.85.216.182]:36379 "EHLO mail-px0-f182.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751619AbZFCCJl (ORCPT ); Tue, 2 Jun 2009 22:09:41 -0400 X-Greylist: delayed 491 seconds by postgrey-1.27 at vger.kernel.org; Tue, 02 Jun 2009 22:09:41 EDT Received: by pxi12 with SMTP id 12so409576pxi.33 for ; Tue, 02 Jun 2009 19:09:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:subject:from:to:cc :content-type:date:message-id:mime-version:x-mailer :content-transfer-encoding; bh=L5fYbBgJ7HRTqR0v5A/ZyZYbxU3/EnajWfdYwMXnwQk=; b=RHcMSE+NxeKdm9SMHWkg1irVkh9qV3HVgUTbm658VfDbLyvnJQKAgpu7XosW3kXjSR BG7Mm3Lj4jWSEa240rufSxShiDes/PXDL0z+U/lwOGrJyn6Ek7nARL5BsjsXODVjSOCh JpNeQcnumAMiWZgQ8avOhzcpoxJgwh0osm8aU= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=subject:from:to:cc:content-type:date:message-id:mime-version :x-mailer:content-transfer-encoding; b=G7g+8QOAm9ChTAcOphv/ZfMs//yIuBi0x45lcl5a9O1EyoX2vsf2lb38b+CeRkx6WA GB5YkrD8CaohpqzwX193xfxbm887K9jTfsWpiEhq34GIbj4zIaX0Pgt0fY6OdS8RRvmH o+1tmEQboR8/6zPoqhfejqh+dK65Fl8hilDy0= Received: by 10.143.42.6 with SMTP id u6mr148873wfj.149.1243994491362; Tue, 02 Jun 2009 19:01:31 -0700 (PDT) Received: from ?172.16.3.7? ([116.228.155.46]) by mx.google.com with ESMTPS id 30sm5948729wfd.21.2009.06.02.19.01.19 (version=SSLv3 cipher=RC4-MD5); Tue, 02 Jun 2009 19:01:30 -0700 (PDT) Subject: [PATCH]videobuf-core.c: add pointer check From: "Figo.zhang" To: Mauro Carvalho Chehab Cc: linux-media@vger.kernel.org, Hans Verkuil , Trent Piepho Date: Wed, 03 Jun 2009 10:01:04 +0800 Message-Id: <1243994465.3459.9.camel@myhost> Mime-Version: 1.0 X-Mailer: Evolution 2.26.2 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org add poiter check for videobuf_queue_core_init(). any guys who write a v4l driver, pass a NULL pointer or a non-inintial pointer to the first parameter such as videobuf_queue_sg_init() , it would be crashed. Signed-off-by: Figo.zhang --- drivers/media/video/videobuf-core.c | 1 + 1 files changed, 1 insertions(+), 0 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/videobuf-core.c b/drivers/media/video/videobuf-core.c index b7b0584..5f41fd9 100644 --- a/drivers/media/video/videobuf-core.c +++ b/drivers/media/video/videobuf-core.c @@ -118,6 +118,7 @@ void videobuf_queue_core_init(struct videobuf_queue *q, void *priv, struct videobuf_qtype_ops *int_ops) { + BUG_ON(!q); memset(q, 0, sizeof(*q)); q->irqlock = irqlock; q->dev = dev;