]> git.droids-corp.org - dpdk.git/commitdiff
vdpa/sfc: fix null dereference during removal
authorWeiguo Li <liwg06@foxmail.com>
Sat, 29 Jan 2022 17:30:12 +0000 (01:30 +0800)
committerMaxime Coquelin <maxime.coquelin@redhat.com>
Thu, 10 Feb 2022 15:07:44 +0000 (16:07 +0100)
When sva is null, sfc_vdpa_info(sva, ...) will cause a null
dereference. Use SFC_VDPA_GENERIC_LOG() to avoid that.
See macros sfc_vdpa_info and SFC_VDPA_GENERIC_LOG
defined in drivers/vdpa/sfc/sfc_vdpa_log.h for detail.

Fixes: 5e7596ba7cb3 ("vdpa/sfc: introduce Xilinx vDPA driver")
Cc: stable@dpdk.org
Signed-off-by: Weiguo Li <liwg06@foxmail.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
drivers/vdpa/sfc/sfc_vdpa.c

index fccdd8c687d21f78fe1027eda081b541f8b1eaa3..53f598facc7529d6b5f755eae76e8e94cc5be8e7 100644 (file)
@@ -328,7 +328,8 @@ sfc_vdpa_pci_remove(struct rte_pci_device *pci_dev)
 
        sva = sfc_vdpa_get_adapter_by_dev(pci_dev);
        if (sva == NULL) {
-               sfc_vdpa_info(sva, "invalid device: %s", pci_dev->name);
+               SFC_VDPA_GENERIC_LOG(INFO,
+                       "Invalid device: %s.", pci_dev->name);
                return -1;
        }