[06/12] igc: Improve address check in igc_del_mac_filter()
diff mbox series

Message ID 20200318230102.36952-7-andre.guedes@intel.com
State Under Review
Delegated to: Jeff Kirsher
Headers show
Series
  • igc: Refactor MAC address filtering code
Related show

Commit Message

Andre Guedes March 18, 2020, 11 p.m. UTC
igc_add_mac_filter() doesn't allow filters with invalid MAC address to
be added to adapter->mac_table so, in igc_del_mac_filter(), we can early
return if MAC address is invalid. No need to traverse the table.

Signed-off-by: Andre Guedes <andre.guedes@intel.com>
---
 drivers/net/ethernet/intel/igc/igc_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Brown, Aaron F March 31, 2020, 8:01 p.m. UTC | #1
> From: Intel-wired-lan <intel-wired-lan-bounces@osuosl.org> On Behalf Of
> Andre Guedes
> Sent: Wednesday, March 18, 2020 4:01 PM
> To: intel-wired-lan@lists.osuosl.org
> Subject: [Intel-wired-lan] [PATCH 06/12] igc: Improve address check in
> igc_del_mac_filter()
> 
> igc_add_mac_filter() doesn't allow filters with invalid MAC address to
> be added to adapter->mac_table so, in igc_del_mac_filter(), we can early
> return if MAC address is invalid. No need to traverse the table.
> 
> Signed-off-by: Andre Guedes <andre.guedes@intel.com>
> ---
>  drivers/net/ethernet/intel/igc/igc_main.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Tested-by: Aaron Brown <aaron.f.brown@intel.com>

Patch
diff mbox series

diff --git a/drivers/net/ethernet/intel/igc/igc_main.c b/drivers/net/ethernet/intel/igc/igc_main.c
index 0ca7afaf6fc7..a71f1a5ca27c 100644
--- a/drivers/net/ethernet/intel/igc/igc_main.c
+++ b/drivers/net/ethernet/intel/igc/igc_main.c
@@ -2247,7 +2247,7 @@  static int igc_del_mac_filter(struct igc_adapter *adapter, const u8 *addr,
 	int rar_entries = hw->mac.rar_entry_count;
 	int i;
 
-	if (is_zero_ether_addr(addr))
+	if (!is_valid_ether_addr(addr))
 		return -EINVAL;
 
 	/* Search for matching entry in the MAC table based on given address