Skip to content

Commit

Permalink
igb: Replace GFP_ATOMIC with GFP_KERNEL in igb_sw_init()
Browse files Browse the repository at this point in the history
igb_sw_init() is never called in atomic context.
It calls kzalloc() and kcalloc() with GFP_ATOMIC, which is not necessary.
GFP_ATOMIC can be replaced with GFP_KERNEL.

This is found by a static analysis tool named DCNS written by myself.

Signed-off-by: Jia-Ju Bai <[email protected]>
Tested-by: Aaron Brown <[email protected]>
Signed-off-by: Jeff Kirsher <[email protected]>
  • Loading branch information
XidianGeneral authored and Jeff Kirsher committed Aug 24, 2018
1 parent a798fba commit 1513562
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/net/ethernet/intel/igb/igb_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -3873,7 +3873,7 @@ static int igb_sw_init(struct igb_adapter *adapter)

adapter->mac_table = kcalloc(hw->mac.rar_entry_count,
sizeof(struct igb_mac_addr),
GFP_ATOMIC);
GFP_KERNEL);
if (!adapter->mac_table)
return -ENOMEM;

Expand All @@ -3883,7 +3883,7 @@ static int igb_sw_init(struct igb_adapter *adapter)

/* Setup and initialize a copy of the hw vlan table array */
adapter->shadow_vfta = kcalloc(E1000_VLAN_FILTER_TBL_SIZE, sizeof(u32),
GFP_ATOMIC);
GFP_KERNEL);
if (!adapter->shadow_vfta)
return -ENOMEM;

Expand Down

0 comments on commit 1513562

Please sign in to comment.