In qlnxr_add(), dev->pdev is allocated by kzalloc(), where a check
should be enforced.

Signed-off-by: Gen Zhang <[email protected]>
---
diff --git a/sys/dev/qlnx/qlnxr/qlnxr_os.c b/sys/dev/qlnx/qlnxr/qlnxr_os.c
index a9e426e..6f9abf1 100644
--- a/sys/dev/qlnx/qlnxr/qlnxr_os.c
+++ b/sys/dev/qlnx/qlnxr/qlnxr_os.c
@@ -1115,6 +1115,8 @@ qlnxr_add(void *eth_dev)
        dev->cdev = &ha->cdev;
        /* Added to extend Application support */
        dev->pdev = kzalloc(sizeof(struct pci_dev), GFP_KERNEL);
+       if (!dev->pdev)
+               goto qlnxr_add_err;
 
         dev->pdev->dev = *(dev->ha->pci_dev);
         dev->pdev->device = pci_get_device(dev->ha->pci_dev);
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-bugs
To unsubscribe, send any mail to "[email protected]"

Reply via email to