aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/cavium/thunder/thunder_bgx.c
diff options
context:
space:
mode:
authorColin Ian King <colin.king@canonical.com>2018-08-06 17:50:45 +0100
committerDavid S. Miller <davem@davemloft.net>2018-08-07 12:38:13 -0700
commita94cead71c4651da5649134e3cdc29b1f32327a2 (patch)
treea26541f68ed60e03f3b5c6b2ce8886ce2f1e1e9a /drivers/net/ethernet/cavium/thunder/thunder_bgx.c
parentcxgb4: mk_act_open_req() buggers ->{local, peer}_ip on big-endian hosts (diff)
downloadlinux-dev-a94cead71c4651da5649134e3cdc29b1f32327a2.tar.xz
linux-dev-a94cead71c4651da5649134e3cdc29b1f32327a2.zip
net: thunderx: check for failed allocation lmac->dmacs
The allocation of lmac->dmacs is not being checked for allocation failure. Add the check. Fixes: 3a34ecfd9d3f ("net: thunderx: add MAC address filter tracking for LMAC") Signed-off-by: Colin Ian King <colin.king@canonical.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/cavium/thunder/thunder_bgx.c')
-rw-r--r--drivers/net/ethernet/cavium/thunder/thunder_bgx.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/net/ethernet/cavium/thunder/thunder_bgx.c b/drivers/net/ethernet/cavium/thunder/thunder_bgx.c
index 5d08d2aeb172..e337da6ba2a4 100644
--- a/drivers/net/ethernet/cavium/thunder/thunder_bgx.c
+++ b/drivers/net/ethernet/cavium/thunder/thunder_bgx.c
@@ -1083,6 +1083,8 @@ static int bgx_lmac_enable(struct bgx *bgx, u8 lmacid)
lmac->dmacs_count = (RX_DMAC_COUNT / bgx->lmac_count);
lmac->dmacs = kcalloc(lmac->dmacs_count, sizeof(*lmac->dmacs),
GFP_KERNEL);
+ if (!lmac->dmacs)
+ return -ENOMEM;
/* Enable lmac */
bgx_reg_modify(bgx, lmacid, BGX_CMRX_CFG, CMR_EN);