misc: cb710: core:- Handle return NULL error from pcim_iomap_table
Subsystems (2)
PATCH 1/1 misc: cb710: core:- Handle return NULL error from pcim_iomap_table
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 <[email protected]>
--- drivers/misc/cb710/core.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/misc/cb710/core.c +2 -0
@@ -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);
Signature · 1 line
1.7.9.5
Ignore this change. Sorry for the noise.
Thanks
Arvind
Quoted 22 lines · Arvind Yadav
Here, If
pcim_iomap_tablewill 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 <[email protected]>--- drivers/misc/cb710/core.c | 2 ++ 1 file changed, 2 insertions(+)drivers/misc/cb710/core.c +2
-0@@ -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);