Skip to content

Commit

Permalink
bnxt_en: Check for zero dir entries in NVRAM.
Browse files Browse the repository at this point in the history
If firmware goes into unstable state, HWRM_NVM_GET_DIR_INFO firmware
command may return zero dir entries. Return error in such case to
avoid zero length dma buffer request.

Fixes: c0c050c ("bnxt_en: New Broadcom ethernet driver.")
Signed-off-by: Vasundhara Volam <vasundhara-v.volam@broadcom.com>
Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Vasundhara Volam authored and David S. Miller committed Aug 26, 2020
1 parent c1c2d77 commit dbbfa96
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c
Original file line number Diff line number Diff line change
Expand Up @@ -2323,6 +2323,9 @@ static int bnxt_get_nvram_directory(struct net_device *dev, u32 len, u8 *data)
if (rc != 0)
return rc;

if (!dir_entries || !entry_length)
return -EIO;

/* Insert 2 bytes of directory info (count and size of entries) */
if (len < 2)
return -EINVAL;
Expand Down

0 comments on commit dbbfa96

Please sign in to comment.