linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mmc: sdhci-of-arasan: Add NULL check for data field
@ 2022-05-12  7:19 Sai Krishna Potthuri
  2022-05-12 11:47 ` Adrian Hunter
  2022-05-16 13:55 ` Ulf Hansson
  0 siblings, 2 replies; 3+ messages in thread
From: Sai Krishna Potthuri @ 2022-05-12  7:19 UTC (permalink / raw)
  To: Ulf Hansson, Michal Simek, Adrian Hunter
  Cc: linux-kernel, linux-mmc, linux-arm-kernel, git, saikrishna12468,
	sgoud, Sai Krishna Potthuri

Add NULL check for data field retrieved from of_device_get_match_data()
before dereferencing the data.
Addresses-coverity: CID 305057:Dereference null return value (NULL_RETURNS)

Signed-off-by: Sai Krishna Potthuri <lakshmi.sai.krishna.potthuri@xilinx.com>
---
 drivers/mmc/host/sdhci-of-arasan.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/mmc/host/sdhci-of-arasan.c b/drivers/mmc/host/sdhci-of-arasan.c
index 6a2e5a468424..757801dfc308 100644
--- a/drivers/mmc/host/sdhci-of-arasan.c
+++ b/drivers/mmc/host/sdhci-of-arasan.c
@@ -1577,6 +1577,9 @@ static int sdhci_arasan_probe(struct platform_device *pdev)
 	const struct sdhci_arasan_of_data *data;
 
 	data = of_device_get_match_data(dev);
+	if (!data)
+		return -EINVAL;
+
 	host = sdhci_pltfm_init(pdev, data->pdata, sizeof(*sdhci_arasan));
 
 	if (IS_ERR(host))
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] mmc: sdhci-of-arasan: Add NULL check for data field
  2022-05-12  7:19 [PATCH] mmc: sdhci-of-arasan: Add NULL check for data field Sai Krishna Potthuri
@ 2022-05-12 11:47 ` Adrian Hunter
  2022-05-16 13:55 ` Ulf Hansson
  1 sibling, 0 replies; 3+ messages in thread
From: Adrian Hunter @ 2022-05-12 11:47 UTC (permalink / raw)
  To: Sai Krishna Potthuri, Ulf Hansson, Michal Simek
  Cc: linux-kernel, linux-mmc, linux-arm-kernel, git, saikrishna12468, sgoud

On 12/05/22 10:19, Sai Krishna Potthuri wrote:
> Add NULL check for data field retrieved from of_device_get_match_data()
> before dereferencing the data.
> Addresses-coverity: CID 305057:Dereference null return value (NULL_RETURNS)
> 
> Signed-off-by: Sai Krishna Potthuri <lakshmi.sai.krishna.potthuri@xilinx.com>

Acked-by: Adrian Hunter <adrian.hunter@intel.com>

> ---
>  drivers/mmc/host/sdhci-of-arasan.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/mmc/host/sdhci-of-arasan.c b/drivers/mmc/host/sdhci-of-arasan.c
> index 6a2e5a468424..757801dfc308 100644
> --- a/drivers/mmc/host/sdhci-of-arasan.c
> +++ b/drivers/mmc/host/sdhci-of-arasan.c
> @@ -1577,6 +1577,9 @@ static int sdhci_arasan_probe(struct platform_device *pdev)
>  	const struct sdhci_arasan_of_data *data;
>  
>  	data = of_device_get_match_data(dev);
> +	if (!data)
> +		return -EINVAL;
> +
>  	host = sdhci_pltfm_init(pdev, data->pdata, sizeof(*sdhci_arasan));
>  
>  	if (IS_ERR(host))


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] mmc: sdhci-of-arasan: Add NULL check for data field
  2022-05-12  7:19 [PATCH] mmc: sdhci-of-arasan: Add NULL check for data field Sai Krishna Potthuri
  2022-05-12 11:47 ` Adrian Hunter
@ 2022-05-16 13:55 ` Ulf Hansson
  1 sibling, 0 replies; 3+ messages in thread
From: Ulf Hansson @ 2022-05-16 13:55 UTC (permalink / raw)
  To: Sai Krishna Potthuri
  Cc: Michal Simek, Adrian Hunter, linux-kernel, linux-mmc,
	linux-arm-kernel, git, saikrishna12468, sgoud

On Thu, 12 May 2022 at 09:20, Sai Krishna Potthuri
<lakshmi.sai.krishna.potthuri@xilinx.com> wrote:
>
> Add NULL check for data field retrieved from of_device_get_match_data()
> before dereferencing the data.
> Addresses-coverity: CID 305057:Dereference null return value (NULL_RETURNS)
>
> Signed-off-by: Sai Krishna Potthuri <lakshmi.sai.krishna.potthuri@xilinx.com>

Applied for next, thanks!

Kind regards
Uffe


> ---
>  drivers/mmc/host/sdhci-of-arasan.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/drivers/mmc/host/sdhci-of-arasan.c b/drivers/mmc/host/sdhci-of-arasan.c
> index 6a2e5a468424..757801dfc308 100644
> --- a/drivers/mmc/host/sdhci-of-arasan.c
> +++ b/drivers/mmc/host/sdhci-of-arasan.c
> @@ -1577,6 +1577,9 @@ static int sdhci_arasan_probe(struct platform_device *pdev)
>         const struct sdhci_arasan_of_data *data;
>
>         data = of_device_get_match_data(dev);
> +       if (!data)
> +               return -EINVAL;
> +
>         host = sdhci_pltfm_init(pdev, data->pdata, sizeof(*sdhci_arasan));
>
>         if (IS_ERR(host))
> --
> 2.17.1
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-05-16 13:57 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-12  7:19 [PATCH] mmc: sdhci-of-arasan: Add NULL check for data field Sai Krishna Potthuri
2022-05-12 11:47 ` Adrian Hunter
2022-05-16 13:55 ` Ulf Hansson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).