Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp119192pxu; Tue, 5 Jan 2021 06:43:30 -0800 (PST) X-Google-Smtp-Source: ABdhPJyHe9IhZexg2jQzs7X0gN8gtPntcbA0pl20LIOkaL2VE6qH6kuL7lx8u2hZL+igDPN58mcx X-Received: by 2002:a17:906:3d62:: with SMTP id r2mr72568018ejf.295.1609857810525; Tue, 05 Jan 2021 06:43:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609857810; cv=none; d=google.com; s=arc-20160816; b=ohkxRjYppvHQYpCGCZjI9QU5m6nEO8vdxoBhTHWBnF8VFwbA+mdF3ilonUP93TNdlG NwJeN/avsPGs305K1vTNcDs/HmzQ8CL5Q7EktozaBTdJcPWPxEuP4QNOBGVMHkES3ZaQ sflrUVVZlrThKkQTslMOmC3sYLLBw/0XDGmFW71v4DA/hAWJx43cJvAO9xSrnpZbhMMA MGpIMjGmzJEqrz4W/dkGe5jbx6dnHiw4KmzLzRIibCEr6+jrd/dNM3QHfsLZZpgAlpER AD6lubEX/z9e0cwJpHijcqEQ0ioiQjwiJwTn+AKb/0xxvMWOO2rqNN4R6PlqvN/L1qKO w3yQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:organization :from:references:cc:to:subject:ironport-sdr:ironport-sdr; bh=gOTFhKhguZs05z9XViXmr1gig/4Ddoq4iaIuO1q4MIE=; b=FlS+8Hjt2yO8PlimkWZ80yl3/U2V8EbY5F+xNeiaTlOIOAJqB5icsaIaXI6MDfYfOH Xomo6o026IUgcD7+7OHqIa3hK59tczPIPzfxQn/yfLi8KslBPOYJHqmivDTfa4aWvhIk n5HgQporMilLGRFk3sl6JxfmKssYOgyeDTYmterqZzOuaUne7fn6yQZPIQLlJ7eT61eb LUlVd8hox67Wzt8PmirzQW+hcQTVNlwArGLa6zV3qrdDRf/2lx6RVMJaurdS3Ozwoxa/ nfaVQWq470SIcHlYbYoLp6/cfa9Cd9vUO/y5vxEpTdQrFIBFh5CH0o7qly1hDoKyZAkf Q2rw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l15si30502756ejk.413.2021.01.05.06.43.06; Tue, 05 Jan 2021 06:43:30 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727925AbhAEOky (ORCPT + 99 others); Tue, 5 Jan 2021 09:40:54 -0500 Received: from mga18.intel.com ([134.134.136.126]:62478 "EHLO mga18.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726076AbhAEOky (ORCPT ); Tue, 5 Jan 2021 09:40:54 -0500 IronPort-SDR: Gj7OrIdug6cxk3lHQMx8sgC6FkUpkjlQyp9F+EGZMwCuX2ZHCelc2X8p3nCfqSTXxQcAGUO/yN ubRVF9P3fVBw== X-IronPort-AV: E=McAfee;i="6000,8403,9854"; a="164815713" X-IronPort-AV: E=Sophos;i="5.78,477,1599548400"; d="scan'208";a="164815713" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Jan 2021 06:40:13 -0800 IronPort-SDR: Kn8QwbefPJ5XPqoFYBUW0nTKHtZc67lODwp+8nmVmRmipfxboBe8IfmOHqRUN2MzAbi1yMv67Z w9tVX5gP9Fvw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.78,477,1599548400"; d="scan'208";a="421794901" Received: from ahunter-desktop.fi.intel.com (HELO [10.237.72.94]) ([10.237.72.94]) by orsmga001.jf.intel.com with ESMTP; 05 Jan 2021 06:40:11 -0800 Subject: Re: [PATCH] mmc: sdhci-msm: Fix possible NULL pointer exception To: Md Sadre Alam , bjorn.andersson@linaro.org, ulf.hansson@linaro.org, linux-arm-msm@vger.kernel.org, linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org Cc: sricharan@codeaurora.org References: <1608626913-16675-1-git-send-email-mdalam@codeaurora.org> From: Adrian Hunter Organization: Intel Finland Oy, Registered Address: PL 281, 00181 Helsinki, Business Identity Code: 0357606 - 4, Domiciled in Helsinki Message-ID: Date: Tue, 5 Jan 2021 16:39:56 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.12.0 MIME-Version: 1.0 In-Reply-To: <1608626913-16675-1-git-send-email-mdalam@codeaurora.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 22/12/20 10:48 am, Md Sadre Alam wrote: > of_device_get_match_data returns NULL when no match. > So add the NULL pointer check to avoid dereference. > > Signed-off-by: Md Sadre Alam > --- > drivers/mmc/host/sdhci-msm.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/drivers/mmc/host/sdhci-msm.c b/drivers/mmc/host/sdhci-msm.c > index 9c7927b..f20e424 100644 > --- a/drivers/mmc/host/sdhci-msm.c > +++ b/drivers/mmc/host/sdhci-msm.c > @@ -2235,6 +2235,8 @@ static int sdhci_msm_probe(struct platform_device *pdev) > * the data associated with the version info. > */ > var_info = of_device_get_match_data(&pdev->dev); > + if (!var_info) Shouldn't you set ret to -ENODEV here? > + goto pltfm_free; > > msm_host->mci_removed = var_info->mci_removed; > msm_host->restore_dll_config = var_info->restore_dll_config; >