diff options
author | Pan Bian <bianpan2016@163.com> | 2017-04-23 12:52:55 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2017-04-25 21:43:42 +0300 |
commit | a455178e59f2b3591840cc543cf637424bd572d7 (patch) | |
tree | 97b057c33bfa5a55649a3c8400a0745318167b44 | |
parent | 255364f7b8a0fee3fb642b3e1521e943dd67bfb3 (diff) | |
download | linux-a455178e59f2b3591840cc543cf637424bd572d7.tar.xz |
staging: comedi: addi_apci_3xxx: check return value
Function pci_ioremap_bar() will return a NULL pointer if there is no
enough memory. However, in function apci3xxx_auto_attach(), the return
value of function pci_ioremap_bar() is not validated. This may result in
NULL dereference in following access to dev->mmio. This patch fixes the
bug.
Signed-off-by: Pan Bian <bianpan2016@163.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/staging/comedi/drivers/addi_apci_3xxx.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/staging/comedi/drivers/addi_apci_3xxx.c b/drivers/staging/comedi/drivers/addi_apci_3xxx.c index 82c22110f128..be1f6133ff1c 100644 --- a/drivers/staging/comedi/drivers/addi_apci_3xxx.c +++ b/drivers/staging/comedi/drivers/addi_apci_3xxx.c @@ -787,6 +787,8 @@ static int apci3xxx_auto_attach(struct comedi_device *dev, dev->iobase = pci_resource_start(pcidev, 2); dev->mmio = pci_ioremap_bar(pcidev, 3); + if (!dev->mmio) + return -ENOMEM; if (pcidev->irq > 0) { ret = request_irq(pcidev->irq, apci3xxx_irq_handler, |