diff options
author | Michael Chan <michael.chan@broadcom.com> | 2017-10-26 11:51:22 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-10-28 00:02:44 +0900 |
commit | e0ad8fc5980b362028cfd63ec037f4b491e726c6 (patch) | |
tree | 9dd2c3995758a7d47f2ac590654d0327c32607d4 /drivers/net/ethernet/broadcom/bnxt | |
parent | 618784e3ee1870e43e50e1c7922cc123cc050566 (diff) | |
download | linux-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.c | 3 |
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) { |