From patchwork Fri Jul 4 10:52:58 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Russell King - ARM Linux X-Patchwork-Id: 4480621 Return-Path: X-Original-To: patchwork-linux-arm@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 CDAD29F26C for ; Fri, 4 Jul 2014 10:55:18 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 079AD2039D for ; Fri, 4 Jul 2014 10:55:18 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0EEEC202EC for ; Fri, 4 Jul 2014 10:55:17 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1X317V-00026n-1F; Fri, 04 Jul 2014 10:53:33 +0000 Received: from pandora.arm.linux.org.uk ([2001:4d48:ad52:3201:214:fdff:fe10:1be6]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1X317R-0001oD-VX for linux-arm-kernel@lists.infradead.org; Fri, 04 Jul 2014 10:53:30 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=arm.linux.org.uk; s=pandora; h=Sender:In-Reply-To:Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date; bh=KbuzUZQ79bsgPNtJ1/ZOQUlqM6LqHGiEGY/V/Tq11PA=; b=QdXv/DfwDBMWsWrglIaAYI727ltkKIvUr2Gid9ZyuvBcFgw/2B8D/H90J1+j8DhrG5QYgaRCj/0XpDPdARIMpwixmfSsHWMHOroqsau6QMnO8nPA2NJD8id5klsz7M/J4tv4OzZFV4+3iraQiawO2IEvZsUBFR6zVXwnpe2Z5QM=; Received: from n2100.arm.linux.org.uk ([fd8f:7570:feb6:1:214:fdff:fe10:4f86]:46457) by pandora.arm.linux.org.uk with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.76) (envelope-from ) id 1X316y-0007bQ-3r; Fri, 04 Jul 2014 11:53:00 +0100 Received: from linux by n2100.arm.linux.org.uk with local (Exim 4.76) (envelope-from ) id 1X316x-0003K1-1L; Fri, 04 Jul 2014 11:52:59 +0100 Date: Fri, 4 Jul 2014 11:52:58 +0100 From: Russell King - ARM Linux To: Sachin Kamat Subject: Re: [PATCH v3 3/8] component: add support for component match array Message-ID: <20140704105258.GF21766@n2100.arm.linux.org.uk> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.19 (2009-01-05) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140704_035330_303819_DF97F94E X-CRM114-Status: GOOD ( 18.78 ) X-Spam-Score: -0.1 (/) Cc: airlied@linux.ie, Greg Kroah-Hartman , devel@driverdev.osuosl.org, Inki Dae , "linux-arm-kernel@lists.infradead.org" X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=no 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 On Fri, Jul 04, 2014 at 04:17:35PM +0530, Sachin Kamat wrote: > Hi Russell > > > +int component_master_add_with_match(struct device *dev, > > + const struct component_master_ops *ops, > > + struct component_match *match) > > { > > struct master *master; > > int ret; > > > > + if (ops->add_components && match) > > + return -EINVAL; > > + > > + /* Reallocate the match array for its true size */ > > + match = component_match_realloc(dev, match, match->num); > > ^^^^^^^^^^^^^ > This gives a NULL pointer dereference error when match is NULL (as passed > by component_master_add() below). Observed this while testing linux-next > kernel (next-20140704) on Exynos based board with DRM enabled. Thanks for your report. Please verify that the patch below resolves it for you. Thanks. drivers/base/component.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/base/component.c b/drivers/base/component.c index b4236daed4fa..f748430bb654 100644 --- a/drivers/base/component.c +++ b/drivers/base/component.c @@ -293,10 +293,12 @@ int component_master_add_with_match(struct device *dev, if (ops->add_components && match) return -EINVAL; - /* Reallocate the match array for its true size */ - match = component_match_realloc(dev, match, match->num); - if (IS_ERR(match)) - return PTR_ERR(match); + if (match) { + /* Reallocate the match array for its true size */ + match = component_match_realloc(dev, match, match->num); + if (IS_ERR(match)) + return PTR_ERR(match); + } master = kzalloc(sizeof(*master), GFP_KERNEL); if (!master)