Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp11087325pxu; Wed, 30 Dec 2020 22:44:50 -0800 (PST) X-Google-Smtp-Source: ABdhPJxWbQ9wu4ox4SSKjIiOcFqU3FuY5FJzCNJYU2UZlQeEXQEVH9gJBhuKJZiPBedbUx22hDhB X-Received: by 2002:a05:6402:407:: with SMTP id q7mr53750368edv.312.1609397090562; Wed, 30 Dec 2020 22:44:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609397090; cv=none; d=google.com; s=arc-20160816; b=cFSF09fTr1WBe26HHnKfmXL+kvFlz2cSWYAQB6wDJL7jhQgg+Zm8oKe78WPSSA5LoW yd1EtQKiUjVNZJ1FkZCWGaiW0RN1czwGY+yqEKW0Yhff8cw8jOoUILMm2hPbiomXon/t zStLs61+S/68CFYz40akdHlRf+CPkR4DiHXOG1cpD6dAL793ajhvE7L232CHGib+hiYl aKvplzkQDFUthErjPBe8qxkRlsz/FKBgniM+VJY0iu+0Y6DkVynBdFNqoZQqxKvlg1d6 hiP+6cezwey1ZvyVSUvfiTcFsbO9eN5wQUQGiuTdhOkmQOk4AC0s1zr1SOB2CrcizhOF K5cg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-language:content-transfer-encoding :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dmarc-filter:sender:dkim-signature; bh=OG7q1REiQSPkTlES34Ckv8c4QBwurXTi+jB+GQDEsKI=; b=Yppk1urGEhuM9/wcesT/ZD932J+hWdl9NtbzvIhPJZqjDNd1lUM5p4qyx77V97rMfn VQYhXoFZZelyOpnP3uYDBWicvDxnoCUAjBLxHzmYPf0jVbai9c9MBGlBDOX/pKXKjEOU 7CLM1DQIEVO2yygx2cJUa5QReEQWDwMlkfeRc9QIc/HwFfplu6hqD9Qwa2Lwc8ogA2Cl 9wMvJ+HiljjDrUvOj5n+871sSDHX4+HAXQJFuT485WKKvXkYPVPnWR5MiOWtYDrQk1sH SIUUwXsv6PZ0MumThEBslBgoca4ApTvIskLQVh+d3omCg6VkOcJB5M6BRBd7ggvWZxp6 +qDg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mg.codeaurora.org header.s=smtp header.b=DXmtZU9r; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q8si22539148ejj.24.2020.12.30.22.44.25; Wed, 30 Dec 2020 22:44:50 -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; dkim=pass header.i=@mg.codeaurora.org header.s=smtp header.b=DXmtZU9r; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726305AbgLaGm5 (ORCPT + 99 others); Thu, 31 Dec 2020 01:42:57 -0500 Received: from m43-15.mailgun.net ([69.72.43.15]:44046 "EHLO m43-15.mailgun.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726155AbgLaGm5 (ORCPT ); Thu, 31 Dec 2020 01:42:57 -0500 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1609396954; h=Content-Transfer-Encoding: Content-Type: In-Reply-To: MIME-Version: Date: Message-ID: From: References: Cc: To: Subject: Sender; bh=OG7q1REiQSPkTlES34Ckv8c4QBwurXTi+jB+GQDEsKI=; b=DXmtZU9r5VmzxWHXEbrpZn6gA2KqDSHgRSc3CR3bUhVrgvz/E7hQkQtusiMdLJy1Jo2Z8DFj 9J3oDgoa6scZylhjTV+4VMXV6kj8mVz/VOK0Tuq1dcz8Kf5iYaLkgpgYqDTxzJDSL/Nh+O6e aGAUuIRX43ylSzFnhh+LiSoGULk= X-Mailgun-Sending-Ip: 69.72.43.15 X-Mailgun-Sid: WyI0MWYwYSIsICJsaW51eC1rZXJuZWxAdmdlci5rZXJuZWwub3JnIiwgImJlOWU0YSJd Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by smtp-out-n04.prod.us-east-1.postgun.com with SMTP id 5fed72bd584481b01bdb3188 (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Thu, 31 Dec 2020 06:42:05 GMT Sender: vbadigan=codeaurora.org@mg.codeaurora.org Received: by smtp.codeaurora.org (Postfix, from userid 1001) id B26A7C43462; Thu, 31 Dec 2020 06:42:04 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-caf-mail-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.3 required=2.0 tests=ALL_TRUSTED,BAYES_00, NICE_REPLY_A,SPF_FAIL,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from [192.168.1.7] (unknown [117.198.144.215]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: vbadigan) by smtp.codeaurora.org (Postfix) with ESMTPSA id 84A56C433CA; Thu, 31 Dec 2020 06:42:00 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 84A56C433CA Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; spf=fail smtp.mailfrom=vbadigan@codeaurora.org Subject: Re: [PATCH] mmc: sdhci-msm: Fix possible NULL pointer exception To: Md Sadre Alam , bjorn.andersson@linaro.org, adrian.hunter@intel.com, 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: Veerabhadrarao Badiganti Message-ID: <9687f027-7a5d-2959-82fe-96e68d59c1ab@codeaurora.org> Date: Thu, 31 Dec 2020 12:11:52 +0530 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.6.0 MIME-Version: 1.0 In-Reply-To: <1608626913-16675-1-git-send-email-mdalam@codeaurora.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 12/22/2020 2:18 PM, 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 > --- Reviewed-by: Veerabhadrarao Badiganti > 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) > + goto pltfm_free; > > msm_host->mci_removed = var_info->mci_removed; > msm_host->restore_dll_config = var_info->restore_dll_config;