linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [v1] mmc: host: dw_mmc-pci:- Handle return NULL error from pcim_iomap_table
@ 2016-12-22 12:06 Arvind Yadav
  2016-12-22 17:12 ` arvind Yadav
  0 siblings, 1 reply; 2+ messages in thread
From: Arvind Yadav @ 2016-12-22 12:06 UTC (permalink / raw)
  To: jh80.chung, ulf.hansson; +Cc: linux-mmc, linux-kernel

Here, If pcim_iomap_table will fail. It will return NULL.
Kernel can run into a NULL-pointer dereference.
This error check will avoid NULL pointer dereference.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
---
 drivers/mmc/host/dw_mmc-pci.c |    2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/mmc/host/dw_mmc-pci.c b/drivers/mmc/host/dw_mmc-pci.c
index ab82796..f42d302 100644
--- a/drivers/mmc/host/dw_mmc-pci.c
+++ b/drivers/mmc/host/dw_mmc-pci.c
@@ -61,6 +61,8 @@ static int dw_mci_pci_probe(struct pci_dev *pdev,
 		return ret;
 
 	host->regs = pcim_iomap_table(pdev)[PCI_BAR_NO];
+	if (!host->regs)
+		return -ENOMEM;
 
 	pci_set_master(pdev);
 
-- 
1.7.9.5

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

* Re: [v1] mmc: host: dw_mmc-pci:- Handle return NULL error from pcim_iomap_table
  2016-12-22 12:06 [v1] mmc: host: dw_mmc-pci:- Handle return NULL error from pcim_iomap_table Arvind Yadav
@ 2016-12-22 17:12 ` arvind Yadav
  0 siblings, 0 replies; 2+ messages in thread
From: arvind Yadav @ 2016-12-22 17:12 UTC (permalink / raw)
  To: jh80.chung, ulf.hansson; +Cc: linux-mmc, linux-kernel

Ignore this change. Sorry for noise.

Thanks
-Arvind

On Thursday 22 December 2016 05:36 PM, Arvind Yadav wrote:
> Here, If pcim_iomap_table will fail. It will return NULL.
> Kernel can run into a NULL-pointer dereference.
> This error check will avoid NULL pointer dereference.
>
> Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
> ---
>   drivers/mmc/host/dw_mmc-pci.c |    2 ++
>   1 file changed, 2 insertions(+)
>
> diff --git a/drivers/mmc/host/dw_mmc-pci.c b/drivers/mmc/host/dw_mmc-pci.c
> index ab82796..f42d302 100644
> --- a/drivers/mmc/host/dw_mmc-pci.c
> +++ b/drivers/mmc/host/dw_mmc-pci.c
> @@ -61,6 +61,8 @@ static int dw_mci_pci_probe(struct pci_dev *pdev,
>   		return ret;
>   
>   	host->regs = pcim_iomap_table(pdev)[PCI_BAR_NO];
> +	if (!host->regs)
> +		return -ENOMEM;
>   
>   	pci_set_master(pdev);
>   

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

end of thread, other threads:[~2016-12-22 17:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-12-22 12:06 [v1] mmc: host: dw_mmc-pci:- Handle return NULL error from pcim_iomap_table Arvind Yadav
2016-12-22 17:12 ` arvind Yadav

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).