From e309e9206123d07b7b3bf1e87a934fada636a87d Mon Sep 17 00:00:00 2001 From: Maxime Coquelin Date: Tue, 6 Oct 2020 12:04:20 +0200 Subject: [PATCH] baseband/fpga_5gnr_fec: fix crash with debug When RTE_LIBRTE_BBDEV_DEBUG is enabled, rte_device's driver pointer is dereferenced twice in fpga_5gnr_fec's probe callback. It causes a segmentation fault because this pointer is only assigned after probe callback call. This patch makes use of rte_pci_driver pointer instead. Fixes: 0b5927cbcba7 ("baseband/fpga_5gnr_fec: add PMD for FPGA 5GNR FEC") Cc: stable@dpdk.org Signed-off-by: Maxime Coquelin Acked-by: Nicolas Chautru --- drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c b/drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c index 1d73f9540e..bd99fb4881 100644 --- a/drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c +++ b/drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c @@ -1839,7 +1839,7 @@ fpga_5gnr_fec_init(struct rte_bbdev *dev, struct rte_pci_driver *drv) rte_bbdev_log_debug( "Init device %s [%s] @ virtaddr %p phyaddr %#"PRIx64, - dev->device->driver->name, dev->data->name, + drv->driver.name, dev->data->name, (void *)pci_dev->mem_resource[0].addr, pci_dev->mem_resource[0].phys_addr); } @@ -1895,7 +1895,7 @@ fpga_5gnr_fec_probe(struct rte_pci_driver *pci_drv, ((uint16_t)(version_id >> 16)), ((uint16_t)version_id)); #ifdef RTE_LIBRTE_BBDEV_DEBUG - if (!strcmp(bbdev->device->driver->name, + if (!strcmp(pci_drv->driver.name, RTE_STR(FPGA_5GNR_FEC_PF_DRIVER_NAME))) print_static_reg_debug_info(d->mmio_base); #endif -- 2.20.1