bus/ifpga: fix null pointer dereference in scan
authorRosen Xu <rosen.xu@intel.com>
Tue, 22 May 2018 10:26:18 +0000 (18:26 +0800)
committerThomas Monjalon <thomas@monjalon.net>
Tue, 22 May 2018 17:16:26 +0000 (19:16 +0200)
Fix ifpga_scan_one() null pointer dereferences issue.

Coverity issue: 279454
Fixes: 05fa3d4a6539 ("bus/ifpga: add Intel FPGA bus library")
Cc: stable@dpdk.org
Signed-off-by: Rosen Xu <rosen.xu@intel.com>
drivers/bus/ifpga/ifpga_bus.c

index db16173..b324872 100644 (file)
@@ -159,7 +159,8 @@ ifpga_scan_one(struct rte_rawdev *rawdev,
                goto end;
 
        strlcpy(afu_pr_conf.bs_path, path, sizeof(afu_pr_conf.bs_path));
-       if (rawdev->dev_ops->firmware_load &&
+       if (rawdev->dev_ops &&
+               rawdev->dev_ops->firmware_load &&
                rawdev->dev_ops->firmware_load(rawdev,
                                &afu_pr_conf)){
                IFPGA_BUS_ERR("firmware load error %d\n", ret);