Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1546281 > unrolled thread

[v1] misc: cb710: core:- Handle return NULL error from pcim_iomap_table

Started byArvind Yadav <arvind.yadav.cs@gmail.com>
First post2016-12-22 13:00 +0100
Last post2016-12-22 18:20 +0100
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [v1] misc: cb710: core:- Handle return NULL error from pcim_iomap_table Arvind Yadav <arvind.yadav.cs@gmail.com> - 2016-12-22 13:00 +0100
    Re: [v1] misc: cb710: core:- Handle return NULL error from  pcim_iomap_table arvind Yadav <arvind.yadav.cs@gmail.com> - 2016-12-22 18:20 +0100

#1546281 — [v1] misc: cb710: core:- Handle return NULL error from pcim_iomap_table

FromArvind Yadav <arvind.yadav.cs@gmail.com>
Date2016-12-22 13:00 +0100
Subject[v1] misc: cb710: core:- Handle return NULL error from pcim_iomap_table
Message-ID<sRacp-zp-3@gated-at.bofh.it>
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

[toc] | [next] | [standalone]


#1546500 — Re: [v1] misc: cb710: core:- Handle return NULL error from pcim_iomap_table

Fromarvind Yadav <arvind.yadav.cs@gmail.com>
Date2016-12-22 18:20 +0100
SubjectRe: [v1] misc: cb710: core:- Handle return NULL error from pcim_iomap_table
Message-ID<sRfc6-3Sa-13@gated-at.bofh.it>
In reply to#1546281
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);
>   

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web