Skip to content

Commit

Permalink
net: dsa: hellcreek: Use is_zero_ether_addr() instead of memcmp()
Browse files Browse the repository at this point in the history
Using is_zero_ether_addr() instead of directly use
memcmp() to determine if the ethernet address is all
zeros.

Reported-by: Hulk Robot <[email protected]>
Signed-off-by: Zou Wei <[email protected]>
Reviewed-by: Kurt Kanzenbach <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
SamuelZOU authored and davem330 committed Jun 7, 2021
1 parent cda9de0 commit 3f07ce8
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions drivers/net/dsa/hirschmann/hellcreek.c
Original file line number Diff line number Diff line change
Expand Up @@ -927,7 +927,6 @@ static int hellcreek_fdb_dump(struct dsa_switch *ds, int port,

/* Read table */
for (i = 0; i < hellcreek->fdb_entries; ++i) {
unsigned char null_addr[ETH_ALEN] = { 0 };
struct hellcreek_fdb_entry entry = { 0 };

/* Read entry */
Expand All @@ -937,7 +936,7 @@ static int hellcreek_fdb_dump(struct dsa_switch *ds, int port,
hellcreek_write(hellcreek, 0x00, HR_FDBRDH);

/* Check valid */
if (!memcmp(entry.mac, null_addr, ETH_ALEN))
if (is_zero_ether_addr(entry.mac))
continue;

/* Check port mask */
Expand Down

0 comments on commit 3f07ce8

Please sign in to comment.