summaryrefslogtreecommitdiffstats
path: root/drivers/net/nfp/nfp_nfpu.c
diff options
context:
space:
mode:
authorLuca Boccassi <luca.boccassi@gmail.com>2017-11-13 10:38:04 +0000
committerLuca Boccassi <luca.boccassi@gmail.com>2017-11-13 10:38:39 +0000
commit976be7358289d46cd5ed8131bbf2e2c5a6838d3c (patch)
tree5e6f873dd1658446539f9d4621e2d16f559c867d /drivers/net/nfp/nfp_nfpu.c
parent055c52583a2794da8ba1e85a48cce3832372b12f (diff)
New upstream version 17.11~rc4
Change-Id: I5cc288310eaa28cb8c2e475afce5e19f8c08ba1e Signed-off-by: Luca Boccassi <luca.boccassi@gmail.com>
Diffstat (limited to 'drivers/net/nfp/nfp_nfpu.c')
-rw-r--r--drivers/net/nfp/nfp_nfpu.c5
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;