diff options
Diffstat (limited to 'drivers/net/nfp/nfp_nfpu.c')
-rw-r--r-- | drivers/net/nfp/nfp_nfpu.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/net/nfp/nfp_nfpu.c b/drivers/net/nfp/nfp_nfpu.c index 5775d8da..f11afef3 100644 --- a/drivers/net/nfp/nfp_nfpu.c +++ b/drivers/net/nfp/nfp_nfpu.c @@ -75,8 +75,13 @@ nfpu_open(struct rte_pci_device *pci_dev, nfpu_desc_t *desc, int nfp) /* barsz in log2 */ while (barsz >>= 1) i++; + barsz = i; + /* Sanity check: we can assume any bar size less than 1MB an error */ + if (barsz < 20) + return -1; + /* Getting address for NFP expansion BAR registers */ cfg_base = pci_dev->mem_resource[0].addr; cfg_base = (uint8_t *)cfg_base + NFP_CFG_EXP_BAR_CFG_BASE; |