Commit e0ad8fc5 authored by Michael Chan's avatar Michael Chan Committed by David S. Miller

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: default avatarMichael Chan <michael.chan@broadcom.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 618784e3
...@@ -1773,6 +1773,9 @@ static int bnxt_get_nvram_item(struct net_device *dev, u32 index, u32 offset, ...@@ -1773,6 +1773,9 @@ static int bnxt_get_nvram_item(struct net_device *dev, u32 index, u32 offset,
dma_addr_t dma_handle; dma_addr_t dma_handle;
struct hwrm_nvm_read_input req = {0}; struct hwrm_nvm_read_input req = {0};
if (!length)
return -EINVAL;
buf = dma_alloc_coherent(&bp->pdev->dev, length, &dma_handle, buf = dma_alloc_coherent(&bp->pdev->dev, length, &dma_handle,
GFP_KERNEL); GFP_KERNEL);
if (!buf) { if (!buf) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment