ixgbe: Return error on failure to allocate mac_table
authorAlexander Duyck <aduyck@mirantis.com>
Tue, 3 Nov 2015 01:09:29 +0000 (17:09 -0800)
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>
Sat, 12 Dec 2015 08:44:18 +0000 (00:44 -0800)
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 <aduyck@mirantis.com>
Tested-by: Phil Schmitt <phillip.j.schmitt@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c

index ebd4522e7879dc44290ca3a82233a030c33f4894..c539b1c712011d7c0e26e1e5f782989fd9bc4565 100644 (file)
@@ -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) {
This page took 0.030123 seconds and 5 git commands to generate.