From patchwork Tue Feb 25 09:48:20 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sachin Kamat X-Patchwork-Id: 25266 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-oa0-f72.google.com (mail-oa0-f72.google.com [209.85.219.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id CFDED20543 for ; Tue, 25 Feb 2014 09:54:19 +0000 (UTC) Received: by mail-oa0-f72.google.com with SMTP id i4sf468355oah.7 for ; Tue, 25 Feb 2014 01:54:19 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe; bh=ZuMR/K7AoH9m1Os7px76sAoxQnzOCG+UxYdECHfDde4=; b=FnOsg6NXy/OMrpK/nMNb6QXOeFHBJbnFaq8No9Xwd0Prt/sR48GLJ76F7XjT5IhPlq U18Zg195S1pVGoL+J5FMq0mIXKoCVjr63TNKGAQri45dPybpjMuafp/l/YGTrAnTjJxj J8G9R3Hx2mtzbM+xD7ZkjoKMGthJfOnBgPWcgWYqZChSBw/4lioc85GDTsnRgj9kvHZs Oc7Z3mwMXTtPSwWdIpS/hDDjIqEIb+trWegKbOyIZu0E2cm9wYEZMDUXgcnsaNhnlrj8 AkQWWQM3CD7hczmZlmIFXML19YcgqxNr4e6z7hrvbiP9C7i+oW3+SonYJFq+LnzZnLnz q52A== X-Gm-Message-State: ALoCoQkHgh5Rl3iaaTC7s1S0n9enLG/MlhSYQlNRlpMjntxSlgwSkVhiTzIQ7dWMIrhVfm64lc1r X-Received: by 10.182.186.105 with SMTP id fj9mr196906obc.5.1393322059374; Tue, 25 Feb 2014 01:54:19 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.35.208 with SMTP id n74ls2379767qgn.65.gmail; Tue, 25 Feb 2014 01:54:19 -0800 (PST) X-Received: by 10.52.230.105 with SMTP id sx9mr272675vdc.10.1393322059211; Tue, 25 Feb 2014 01:54:19 -0800 (PST) Received: from mail-ve0-f169.google.com (mail-ve0-f169.google.com [209.85.128.169]) by mx.google.com with ESMTPS id eb8si6665336vdb.34.2014.02.25.01.54.19 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 25 Feb 2014 01:54:19 -0800 (PST) Received-SPF: neutral (google.com: 209.85.128.169 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.128.169; Received: by mail-ve0-f169.google.com with SMTP id c14so143063vea.14 for ; Tue, 25 Feb 2014 01:54:19 -0800 (PST) X-Received: by 10.220.133.80 with SMTP id e16mr277106vct.13.1393322059127; Tue, 25 Feb 2014 01:54:19 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.220.174.196 with SMTP id u4csp125491vcz; Tue, 25 Feb 2014 01:54:18 -0800 (PST) X-Received: by 10.66.174.165 with SMTP id bt5mr503574pac.151.1393322056045; Tue, 25 Feb 2014 01:54:16 -0800 (PST) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id xn1si3064032pbc.128.2014.02.25.01.54.15; Tue, 25 Feb 2014 01:54:15 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-mmc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751106AbaBYJyN (ORCPT + 7 others); Tue, 25 Feb 2014 04:54:13 -0500 Received: from mail-pd0-f171.google.com ([209.85.192.171]:59504 "EHLO mail-pd0-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750768AbaBYJyM (ORCPT ); Tue, 25 Feb 2014 04:54:12 -0500 Received: by mail-pd0-f171.google.com with SMTP id r10so2036868pdi.2 for ; Tue, 25 Feb 2014 01:54:12 -0800 (PST) X-Received: by 10.66.176.143 with SMTP id ci15mr610929pac.35.1393322051576; Tue, 25 Feb 2014 01:54:11 -0800 (PST) Received: from linaro.sisodomain.com ([115.113.119.130]) by mx.google.com with ESMTPSA id qq5sm8804447pbb.24.2014.02.25.01.54.09 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 25 Feb 2014 01:54:11 -0800 (PST) From: Sachin Kamat To: linux-mmc@vger.kernel.org Cc: ulf.hansson@linaro.org, chris@printf.net, sachin.kamat@linaro.org Subject: [PATCH 02/10] mmc: wmt-sdmmc: Fix NULL pointer dereference Date: Tue, 25 Feb 2014 15:18:20 +0530 Message-Id: <1393321708-9719-2-git-send-email-sachin.kamat@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1393321708-9719-1-git-send-email-sachin.kamat@linaro.org> References: <1393321708-9719-1-git-send-email-sachin.kamat@linaro.org> Sender: linux-mmc-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-mmc@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: sachin.kamat@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.128.169 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , 'of_id' is dereferenced before NULL pointer check. Move it to after the check. Signed-off-by: Sachin Kamat Acked-by: Tony Prisk --- drivers/mmc/host/wmt-sdmmc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/mmc/host/wmt-sdmmc.c b/drivers/mmc/host/wmt-sdmmc.c index e902ed7846b0..498d1f799085 100644 --- a/drivers/mmc/host/wmt-sdmmc.c +++ b/drivers/mmc/host/wmt-sdmmc.c @@ -757,7 +757,7 @@ static int wmt_mci_probe(struct platform_device *pdev) struct device_node *np = pdev->dev.of_node; const struct of_device_id *of_id = of_match_device(wmt_mci_dt_ids, &pdev->dev); - const struct wmt_mci_caps *wmt_caps = of_id->data; + const struct wmt_mci_caps *wmt_caps; int ret; int regular_irq, dma_irq; @@ -766,6 +766,8 @@ static int wmt_mci_probe(struct platform_device *pdev) return -EFAULT; } + wmt_caps = of_id->data; + if (!np) { dev_err(&pdev->dev, "Missing SDMMC description in devicetree\n"); return -EFAULT;