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: 1819901 Return-Path: X-Original-To: patchwork-linux-mmc@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 5CBD9DF2ED for ; Thu, 29 Nov 2012 02:31:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755458Ab2K2CbP (ORCPT ); Wed, 28 Nov 2012 21:31:15 -0500 Received: from mail-qc0-f174.google.com ([209.85.216.174]:38887 "EHLO mail-qc0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755457Ab2K2CbP (ORCPT ); Wed, 28 Nov 2012 21:31:15 -0500 Received: by mail-qc0-f174.google.com with SMTP id o22so10377055qcr.19 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 Cc: yongjun_wei@trendmicro.com.cn, linux-arm-kernel@lists.infradead.org, linux-mmc@vger.kernel.org, devicetree-discuss@lists.ozlabs.org Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.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(-) -- To unsubscribe from this list: send the line "unsubscribe linux-mmc" 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/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);