From patchwork Thu Nov 15 04:51:36 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Axel Lin X-Patchwork-Id: 1746921 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork1.kernel.org (Postfix) with ESMTP id CDB443FCA5 for ; Thu, 15 Nov 2012 04:54:42 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1TYrQg-0003QS-FC; Thu, 15 Nov 2012 04:51:54 +0000 Received: from mail-pb0-f49.google.com ([209.85.160.49]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1TYrQc-0003Q9-06 for linux-arm-kernel@lists.infradead.org; Thu, 15 Nov 2012 04:51:50 +0000 Received: by mail-pb0-f49.google.com with SMTP id un15so832985pbc.36 for ; Wed, 14 Nov 2012 20:51:46 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=message-id:subject:from:to:cc:date:content-type:x-mailer :content-transfer-encoding:mime-version:x-gm-message-state; bh=t+q8E5BsOzit8HEMDwUms/opvwIdke+KNZW9R33cDiI=; b=oJhgQW7bcPmzmwTtVeNorA8r11FgLJZ9WIDPX4/ocTaR3FwrZS6SbKGz8BM44whkxP 0o7VSGEvbFw6MHXhmA/XsHehBdmDZeZOJ+cYT53fNSLJ3gz4m+P+36ZY5uctiUOIRtCy /+UTuvB+RNL18EoM/fzd+z0ze8/kntjggM8vWXQuC9wrDVUa8lRFCzps4vwBPFhtQd5C SlAeCf3c/Go6VhkGAJN5+mFFVFBvgI1ooQcOSNtdZAvqpGjoqt3DYzxXVfGYE+QDvQv7 zTPJoF/gf5EalvXSz2USIJU0RnHBpHKYKjqto8avWupNf2Al0UxhzhNAR28e7oQKOfzf YOGQ== Received: by 10.69.1.73 with SMTP id be9mr948666pbd.116.1352955106328; Wed, 14 Nov 2012 20:51:46 -0800 (PST) Received: from [192.168.0.100] (114-39-103-166.dynamic.hinet.net. [114.39.103.166]) by mx.google.com with ESMTPS id vs3sm8863242pbc.61.2012.11.14.20.51.42 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 14 Nov 2012 20:51:45 -0800 (PST) Message-ID: <1352955096.6793.1.camel@phoenix> Subject: [PATCH 1/4] pinctrl: dove: Prevent NULL dereference if of_match_device returns NULL From: Axel Lin To: Linus Walleij Date: Thu, 15 Nov 2012 12:51:36 +0800 X-Mailer: Evolution 3.2.3-0ubuntu6 Mime-Version: 1.0 X-Gm-Message-State: ALoCoQmqD2aT+RmTm8CPufT3mnMwptKlC2WhJ6Y5P0rJ0MTEl0MNbmF0UH8cYH80b3WkJctVy+/H X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20121114_235150_182993_3BF181BC X-CRM114-Status: GOOD ( 11.00 ) X-Spam-Score: -2.6 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.6 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [209.85.160.49 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: Thomas Petazzoni , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Sebastian Hesselbarth X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org of_match_device() may return NULL. Signed-off-by: Axel Lin --- drivers/pinctrl/mvebu/pinctrl-dove.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/pinctrl/mvebu/pinctrl-dove.c b/drivers/pinctrl/mvebu/pinctrl-dove.c index ffe74b2..a8b9b42 100644 --- a/drivers/pinctrl/mvebu/pinctrl-dove.c +++ b/drivers/pinctrl/mvebu/pinctrl-dove.c @@ -578,8 +578,12 @@ static struct of_device_id dove_pinctrl_of_match[] __devinitdata = { static int __devinit dove_pinctrl_probe(struct platform_device *pdev) { - const struct of_device_id *match = - of_match_device(dove_pinctrl_of_match, &pdev->dev); + const struct of_device_id *match; + + match = of_match_device(dove_pinctrl_of_match, &pdev->dev); + if (!match) + return -ENODEV; + pdev->dev.platform_data = match->data; /*