[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20190725012506.17831-1-navid.emamdoost@gmail.com>
Date: Wed, 24 Jul 2019 20:25:06 -0500
From: Navid Emamdoost <navid.emamdoost@...il.com>
To: unlisted-recipients:; (no To-header on input)
Cc: emamd001@....edu, kjlu@....edu, smccaman@....edu,
secalert@...hat.com, Navid Emamdoost <navid.emamdoost@...il.com>,
Bartlomiej Zolnierkiewicz <b.zolnierkie@...sung.com>,
Jens Axboe <axboe@...nel.dk>, linux-ide@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: [PATCH] pata_ali: check the pci_get_device failure
pci_get_device may fail and return NULL. This eventually will be
dereferenced in __pci_register_driver. So null check is necessary.
Signed-off-by: Navid Emamdoost <navid.emamdoost@...il.com>
---
drivers/ata/pata_ali.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/ata/pata_ali.c b/drivers/ata/pata_ali.c
index 0b122f903b8a..47d9bec1f2e2 100644
--- a/drivers/ata/pata_ali.c
+++ b/drivers/ata/pata_ali.c
@@ -627,6 +627,8 @@ static int __init ali_init(void)
{
int ret;
ali_isa_bridge = pci_get_device(PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M1533, NULL);
+ if (!ali_isa_bridge)
+ return -EINVAL;
ret = pci_register_driver(&ali_pci_driver);
if (ret < 0)
--
2.17.1
Powered by blists - more mailing lists