Skip to content

Commit bbf211b

Browse files
Michael Chandavem330
authored andcommitted
bnxt_en: Return error when allocating zero size context memory.
bnxt_alloc_ctx_pg_tbls() should return error when the memory size of the context memory to set up is zero. By returning success (0), the caller may proceed normally and may crash later when it tries to set up the memory. Fixes: 08fe9d1 ("bnxt_en: Add Level 2 context memory paging support.") Signed-off-by: Michael Chan <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent bae361c commit bbf211b

File tree

1 file changed

+1
-1
lines changed
  • drivers/net/ethernet/broadcom/bnxt

1 file changed

+1
-1
lines changed

drivers/net/ethernet/broadcom/bnxt/bnxt.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6642,7 +6642,7 @@ static int bnxt_alloc_ctx_pg_tbls(struct bnxt *bp,
66426642
int rc;
66436643

66446644
if (!mem_size)
6645-
return 0;
6645+
return -EINVAL;
66466646

66476647
ctx_pg->nr_pages = DIV_ROUND_UP(mem_size, BNXT_PAGE_SIZE);
66486648
if (ctx_pg->nr_pages > MAX_CTX_TOTAL_PAGES) {

0 commit comments

Comments
 (0)