summaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/broadcom/bnxt
diff options
context:
space:
mode:
authorMichael Chan <michael.chan@broadcom.com>2017-10-26 11:51:22 -0400
committerDavid S. Miller <davem@davemloft.net>2017-10-28 00:02:44 +0900
commite0ad8fc5980b362028cfd63ec037f4b491e726c6 (patch)
tree9dd2c3995758a7d47f2ac590654d0327c32607d4 /drivers/net/ethernet/broadcom/bnxt
parent618784e3ee1870e43e50e1c7922cc123cc050566 (diff)
downloadlinux-e0ad8fc5980b362028cfd63ec037f4b491e726c6.tar.bz2
bnxt_en: Check for zero length value in bnxt_get_nvram_item().
Return -EINVAL if the length is zero and not proceed to do essentially nothing. Signed-off-by: Michael Chan <michael.chan@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/broadcom/bnxt')
-rw-r--r--drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c
index 3cbe771b3352..85be1cb41f1a 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c
@@ -1773,6 +1773,9 @@ static int bnxt_get_nvram_item(struct net_device *dev, u32 index, u32 offset,
dma_addr_t dma_handle;
struct hwrm_nvm_read_input req = {0};
+ if (!length)
+ return -EINVAL;
+
buf = dma_alloc_coherent(&bp->pdev->dev, length, &dma_handle,
GFP_KERNEL);
if (!buf) {