mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [v1] misc: cb710: core:- Handle return NULL error from pcim_iomap_table
@ 2016-12-22 11:58 Arvind Yadav
  2016-12-22 17:14 ` arvind Yadav
  0 siblings, 1 reply; 2+ messages in thread
From: Arvind Yadav @ 2016-12-22 11:58 UTC (permalink / raw)
  To: mirq-linux; +Cc: 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/misc/cb710/core.c |    2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/misc/cb710/core.c b/drivers/misc/cb710/core.c
index fb397e7..7b60019 100644
--- a/drivers/misc/cb710/core.c
+++ b/drivers/misc/cb710/core.c
@@ -248,6 +248,8 @@ static int cb710_probe(struct pci_dev *pdev,
 	spin_lock_init(&chip->irq_lock);
 	chip->pdev = pdev;
 	chip->iobase = pcim_iomap_table(pdev)[0];
+	if (!chip->iobase)
+		return -ENOMEM;
 
 	pci_set_drvdata(pdev, chip);
 
-- 
1.7.9.5

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

* Re: [v1] misc: cb710: core:- Handle return NULL error from pcim_iomap_table
  2016-12-22 11:58 [v1] misc: cb710: core:- Handle return NULL error from pcim_iomap_table Arvind Yadav
@ 2016-12-22 17:14 ` arvind Yadav
  0 siblings, 0 replies; 2+ messages in thread
From: arvind Yadav @ 2016-12-22 17:14 UTC (permalink / raw)
  To: mirq-linux; +Cc: linux-kernel

Ignore this change. Sorry for the noise.

Thanks
Arvind


On Thursday 22 December 2016 05:28 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/misc/cb710/core.c |    2 ++
>   1 file changed, 2 insertions(+)
>
> diff --git a/drivers/misc/cb710/core.c b/drivers/misc/cb710/core.c
> index fb397e7..7b60019 100644
> --- a/drivers/misc/cb710/core.c
> +++ b/drivers/misc/cb710/core.c
> @@ -248,6 +248,8 @@ static int cb710_probe(struct pci_dev *pdev,
>   	spin_lock_init(&chip->irq_lock);
>   	chip->pdev = pdev;
>   	chip->iobase = pcim_iomap_table(pdev)[0];
> +	if (!chip->iobase)
> +		return -ENOMEM;
>   
>   	pci_set_drvdata(pdev, chip);
>   

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

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

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-12-22 11:58 [v1] misc: cb710: core:- Handle return NULL error from pcim_iomap_table Arvind Yadav
2016-12-22 17:14 ` arvind Yadav

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®