Netdev Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH] mac80211: use eth_zero_addr() to clear mac address
@ 2020-08-01  9:12 linmiaohe
  2020-08-03 22:37 ` David Miller
  0 siblings, 1 reply; 3+ messages in thread
From: linmiaohe @ 2020-08-01  9:12 UTC (permalink / raw)
  To: johannes, davem, kuba; +Cc: linux-wireless, netdev, linux-kernel, linmiaohe

From: Miaohe Lin <linmiaohe@huawei.com>

Use eth_zero_addr() to clear mac address instead of memset().

Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
---
 net/mac80211/trace.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/net/mac80211/trace.h b/net/mac80211/trace.h
index 1b4709694d2a..50ab5b9d8eab 100644
--- a/net/mac80211/trace.h
+++ b/net/mac80211/trace.h
@@ -22,7 +22,8 @@
 #define LOCAL_PR_ARG	__entry->wiphy_name
 
 #define STA_ENTRY	__array(char, sta_addr, ETH_ALEN)
-#define STA_ASSIGN	(sta ? memcpy(__entry->sta_addr, sta->addr, ETH_ALEN) : memset(__entry->sta_addr, 0, ETH_ALEN))
+#define STA_ASSIGN	(sta ? memcpy(__entry->sta_addr, sta->addr, ETH_ALEN) : \
+				eth_zero_addr(__entry->sta_addr))
 #define STA_NAMED_ASSIGN(s)	memcpy(__entry->sta_addr, (s)->addr, ETH_ALEN)
 #define STA_PR_FMT	" sta:%pM"
 #define STA_PR_ARG	__entry->sta_addr
-- 
2.19.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] mac80211: use eth_zero_addr() to clear mac address
  2020-08-01  9:12 [PATCH] mac80211: use eth_zero_addr() to clear mac address linmiaohe
@ 2020-08-03 22:37 ` David Miller
  0 siblings, 0 replies; 3+ messages in thread
From: David Miller @ 2020-08-03 22:37 UTC (permalink / raw)
  To: linmiaohe; +Cc: johannes, kuba, linux-wireless, netdev, linux-kernel

From: linmiaohe <linmiaohe@huawei.com>
Date: Sat, 1 Aug 2020 17:12:38 +0800

> From: Miaohe Lin <linmiaohe@huawei.com>
> 
> Use eth_zero_addr() to clear mac address instead of memset().
> 
> Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>

If you're going to make this change, you should probably convert this macro
to use eth_addr_copy() at the same time.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] mac80211: use eth_zero_addr() to clear mac address
@ 2020-08-04 11:43 linmiaohe
  0 siblings, 0 replies; 3+ messages in thread
From: linmiaohe @ 2020-08-04 11:43 UTC (permalink / raw)
  To: David Miller; +Cc: johannes, kuba, linux-wireless, netdev, linux-kernel

> David Miller wrote:
>>From: linmiaohe <linmiaohe@huawei.com>
>>Date: Sat, 1 Aug 2020 17:12:38 +0800
>>
>> From: Miaohe Lin <linmiaohe@huawei.com>
>> 
>> Use eth_zero_addr() to clear mac address instead of memset().
>> 
>> Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
>
>If you're going to make this change, you should probably convert this macro to use eth_addr_copy() at the same time.

Many thanks for your reply. I think we should not convert this macro to use ether_addr_copy (). Because ether_addr_copy() required
@dst and @src must both be aligned to u16 and we may not always meet this condition.

Thanks again.


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, back to index

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-01  9:12 [PATCH] mac80211: use eth_zero_addr() to clear mac address linmiaohe
2020-08-03 22:37 ` David Miller
2020-08-04 11:43 linmiaohe

Netdev Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/netdev/0 netdev/git/0.git
	git clone --mirror https://lore.kernel.org/netdev/1 netdev/git/1.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 netdev netdev/ https://lore.kernel.org/netdev \
		netdev@vger.kernel.org
	public-inbox-index netdev

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.netdev


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git