From patchwork Wed Jan 15 05:55:06 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sachin Kamat X-Patchwork-Id: 23213 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-vb0-f69.google.com (mail-vb0-f69.google.com [209.85.212.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 96756202FA for ; Wed, 15 Jan 2014 05:59:29 +0000 (UTC) Received: by mail-vb0-f69.google.com with SMTP id m10sf959681vbh.8 for ; Tue, 14 Jan 2014 21:59:28 -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:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=0O9Qx8ZSjLR5Ndn8f7KCZGhjQrDqdlfD+0m1W8Hzf4E=; b=MOwSM9tDT+z+epa4e3DQlRrk8ZanlE2Fki/ETfpro38yOPyzedF+GyS1kHQP48Nqs+ Q9dl+BrfFd0nGOhno/1+Uzd9xZRq/WPsx0TGn2Pqm3D55EEJPWuQK5cD9ZCYFKuJ3jKv XEo38/1zO68Z2CMiuh3U68B9f50Baskmet9Y1tZ0XY7Sv8udssABYKcoAZeadMhDZUVx SHR9mYWAgQsYCGI9+qlIbGffjoEC9XcJ+7xCKPY/WgLCzuGMu26LFk7Kux+xjXZy69Ou 6FqS7KTivt0WHuLIHcqXp5eqx+UfEsRRDWx0tEX8ah+Dw6TvRuHXVH0W3EZcd4UaTskw OyYg== X-Gm-Message-State: ALoCoQmHiV+9Vi1RqqXqVwbLKIFYHa6F6lVCOZBTxm+yge9PCyye02uFrtn1JyrKtaZ0vqYC3CFa X-Received: by 10.58.155.36 with SMTP id vt4mr204034veb.31.1389765568825; Tue, 14 Jan 2014 21:59:28 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.71.142 with SMTP id v14ls435950qeu.35.gmail; Tue, 14 Jan 2014 21:59:28 -0800 (PST) X-Received: by 10.52.185.132 with SMTP id fc4mr134530vdc.21.1389765568734; Tue, 14 Jan 2014 21:59:28 -0800 (PST) Received: from mail-vb0-f50.google.com (mail-vb0-f50.google.com [209.85.212.50]) by mx.google.com with ESMTPS id au4si1176592ved.36.2014.01.14.21.59.28 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 14 Jan 2014 21:59:28 -0800 (PST) Received-SPF: neutral (google.com: 209.85.212.50 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.212.50; Received: by mail-vb0-f50.google.com with SMTP id w8so238380vbj.9 for ; Tue, 14 Jan 2014 21:59:28 -0800 (PST) X-Received: by 10.220.164.80 with SMTP id d16mr157842vcy.15.1389765568657; Tue, 14 Jan 2014 21:59:28 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.59.13.131 with SMTP id ey3csp250999ved; Tue, 14 Jan 2014 21:59:28 -0800 (PST) X-Received: by 10.66.119.172 with SMTP id kv12mr482334pab.34.1389765567663; Tue, 14 Jan 2014 21:59:27 -0800 (PST) Received: from mail-pd0-f171.google.com (mail-pd0-f171.google.com [209.85.192.171]) by mx.google.com with ESMTPS id gm1si2612712pac.332.2014.01.14.21.59.27 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 14 Jan 2014 21:59:27 -0800 (PST) Received-SPF: neutral (google.com: 209.85.192.171 is neither permitted nor denied by best guess record for domain of sachin.kamat@linaro.org) client-ip=209.85.192.171; Received: by mail-pd0-f171.google.com with SMTP id x10so661122pdj.16 for ; Tue, 14 Jan 2014 21:59:27 -0800 (PST) X-Received: by 10.66.186.174 with SMTP id fl14mr426010pac.108.1389765567231; Tue, 14 Jan 2014 21:59:27 -0800 (PST) Received: from linaro.sisodomain.com ([115.113.119.130]) by mx.google.com with ESMTPSA id kk1sm5423001pbd.22.2014.01.14.21.59.24 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 14 Jan 2014 21:59:26 -0800 (PST) From: Sachin Kamat To: linux-mmc@vger.kernel.org Cc: chris@printf.net, sachin.kamat@linaro.org, patches@linaro.org Subject: [PATCH 2/9] mmc: wmt-sdmmc: Fix NULL pointer dereference Date: Wed, 15 Jan 2014 11:25:06 +0530 Message-Id: <1389765313-16744-2-git-send-email-sachin.kamat@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1389765313-16744-1-git-send-email-sachin.kamat@linaro.org> References: <1389765313-16744-1-git-send-email-sachin.kamat@linaro.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.212.50 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 Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: 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;