bnxt_en: Return error when allocating zero size context memory.
authorMichael Chan <michael.chan@broadcom.com>
Sun, 26 Apr 2020 20:24:41 +0000 (16:24 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 14 May 2020 05:58:23 +0000 (07:58 +0200)
commitcf07e0ccffdec81cdfb439c32015b690c301f357
tree1c3169560dbf647330df09dd8b5f6eb7a7578b43
parent76737d877fabef8c8d5c3c08d29778dc011f7331
bnxt_en: Return error when allocating zero size context memory.

[ Upstream commit bbf211b1ecb891c7e0cc7888834504183fc8b534 ]

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: 08fe9d181606 ("bnxt_en: Add Level 2 context memory paging support.")
Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/net/ethernet/broadcom/bnxt/bnxt.c