From patchwork Thu Nov 29 02:31:14 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Yongjun X-Patchwork-Id: 1819911 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork2.kernel.org (Postfix) with ESMTP id 40DDDDF2ED for ; Thu, 29 Nov 2012 02:33:53 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1TdtuJ-0008MY-Db; Thu, 29 Nov 2012 02:31:19 +0000 Received: from mail-qc0-f177.google.com ([209.85.216.177]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1TdtuG-0008MF-1k for linux-arm-kernel@lists.infradead.org; Thu, 29 Nov 2012 02:31:16 +0000 Received: by mail-qc0-f177.google.com with SMTP id u28so10265776qcs.36 for ; Wed, 28 Nov 2012 18:31:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:cc:content-type; bh=JnuCRsZ0SttlOTYomkXDznQZIIHiwQORn0D/31CVjfs=; b=WJ/mM4/bIM84+1YVsLLvvywMDi+N+JiDZfrTzukcVEabdwqX5PBxUzGV49Y3OcNC7C 4IPj+qozDHQwK6VdDZxrj92lRi7CcyCJ7uoDerbc4/v+o3dUF5zxPpYVvG1sbZQbHePO VblVE9CgWQDE6IoSbtO1WQwj1ajh7tnGb4trwKmTHuiuziUzryhx7FAQ9+fu4R1f601Z FkxzAh9lB9Efp1UefziiPtKF8SfjzRsoGQ/c2fuPzBb5fKQDW87xtzqasnUIL5VOxsp6 H3lRprqQ5MT33iPOKPRhondSSCuKdy9r+5NMz73mpGZ2YDG2o/Ks3BLz9W8FguSd8XS/ irdw== MIME-Version: 1.0 Received: by 10.229.203.72 with SMTP id fh8mr5456149qcb.45.1354156274557; Wed, 28 Nov 2012 18:31:14 -0800 (PST) Received: by 10.229.126.165 with HTTP; Wed, 28 Nov 2012 18:31:14 -0800 (PST) Date: Wed, 28 Nov 2012 21:31:14 -0500 Message-ID: Subject: [PATCH -next] mmc: wmt-sdmmc: fix potential NULL pointer dereference in wmt_mci_probe() From: Wei Yongjun To: linux@prisktech.co.nz, cjb@laptop.org, grant.likely@secretlab.ca, rob.herring@calxeda.com X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20121128_213116_154274_D7A53734 X-CRM114-Status: GOOD ( 10.18 ) X-Spam-Score: -2.7 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (weiyj.lk[at]gmail.com) -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [209.85.216.177 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] -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature Cc: yongjun_wei@trendmicro.com.cn, linux-mmc@vger.kernel.org, devicetree-discuss@lists.ozlabs.org, linux-arm-kernel@lists.infradead.org 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 From: Wei Yongjun The dereference to 'of_id' should be moved below the NULL test. Signed-off-by: Wei Yongjun Acked-by: Tony Prisk --- drivers/mmc/host/wmt-sdmmc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/mmc/host/wmt-sdmmc.c b/drivers/mmc/host/wmt-sdmmc.c index 5ba4605..f737b0c 100644 --- a/drivers/mmc/host/wmt-sdmmc.c +++ b/drivers/mmc/host/wmt-sdmmc.c @@ -773,7 +773,7 @@ static int __devinit 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; @@ -787,6 +787,7 @@ static int __devinit wmt_mci_probe(struct platform_device *pdev) return -EFAULT; } + wmt_caps = of_id->data; regular_irq = irq_of_parse_and_map(np, 0); dma_irq = irq_of_parse_and_map(np, 1);