From: Alexander Duyck Date: Tue, 3 Nov 2015 01:09:29 +0000 (-0800) Subject: ixgbe: Return error on failure to allocate mac_table X-Git-Tag: v4.14-rc1~3609^2~495^2~11 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=530fd82a9fea5bba8e044bdf6fdf2ddc495e3807;p=platform%2Fkernel%2Flinux-rpi.git ixgbe: Return error on failure to allocate mac_table Add a check to make certain mac_table was actually allocated and is not NULL. If it is NULL return -ENOMEM and allow the probe routine to fail rather then causing a NULL pointer dereference further down the line. Signed-off-by: Alexander Duyck Tested-by: Phil Schmitt Signed-off-by: Jeff Kirsher --- diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c index ebd4522..c539b1c 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c @@ -5381,6 +5381,8 @@ static int ixgbe_sw_init(struct ixgbe_adapter *adapter) adapter->mac_table = kzalloc(sizeof(struct ixgbe_mac_addr) * hw->mac.num_rar_entries, GFP_ATOMIC); + if (!adapter->mac_table) + return -ENOMEM; /* Set MAC specific capability flags and exceptions */ switch (hw->mac.type) {