Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

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

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
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -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) {