public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
From: Julia Lawall <julia.lawall@lip6.fr>
To: maowenan <maowenan@huawei.com>
Cc: Joe Perches <joe@perches.com>,
	Larry.Finger@lwfinger.net, gregkh@linuxfoundation.org,
	straube.linux@gmail.com, jananis37@gmail.com,
	devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org,
	kernel-janitors@vger.kernel.org, davem@davemloft.net
Subject: Re: [PATCH net] staging: rtl8188eu: use is_zero_ether_addr() instead of memcmp()
Date: Tue, 12 Mar 2019 07:14:37 +0000	[thread overview]
Message-ID: <alpine.DEB.2.21.1903120813460.2728@hadrien> (raw)
In-Reply-To: <22e39cdc-6c66-f08a-f2b3-e2637e0b810b@huawei.com>



On Tue, 12 Mar 2019, maowenan wrote:

>
>
> On 2019/3/12 14:35, Joe Perches wrote:
> > On Tue, 2019-03-12 at 14:29 +0800, maowenan wrote:
> >> ping...
> >>
> >> On 2019/3/9 11:26, Mao Wenan wrote:
> >>> Using is_zero_ether_addr() instead of directly use
> >>> memcmp() to determine if the ethernet address is all
> >>> zeros.
> > []
> >>> diff --git a/drivers/staging/rtl8188eu/core/rtw_mlme.c b/drivers/staging/rtl8188eu/core/rtw_mlme.c
> > []
> >>> @@ -180,9 +180,8 @@ struct wlan_network *rtw_find_network(struct __queue *scanned_queue, u8 *addr)
> >>>  {
> >>>  	struct list_head *phead, *plist;
> >>>  	struct wlan_network *pnetwork = NULL;
> >>> -	u8 zero_addr[ETH_ALEN] = {0, 0, 0, 0, 0, 0};
> >>>
> >>> -	if (!memcmp(zero_addr, addr, ETH_ALEN)) {
> >>> +	if (is_zero_ether_addr(addr)) {
> >
> > How did you verify that addr is __aligned(2)?
>
> /**
>  * is_zero_ether_addr - Determine if give Ethernet address is all zeros.
>  * @addr: Pointer to a six-byte array containing the Ethernet address
>  *
>  * Return true if the address is all zeroes.
>  */
> I think they are completely equivalent functions, no need to check addr is __aligned(2),
> because addr may be defined as unsigned char MacAddress[ETH_ALEN]; the length is 6.

Perhaps you are confusing with eth_zero_addr, which is just a memset and
has no alignment requirements.

julia

  parent reply	other threads:[~2019-03-12  7:14 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-09  3:26 [PATCH net] staging: rtl8188eu: use is_zero_ether_addr() instead of memcmp() Mao Wenan
2019-03-12  6:29 ` maowenan
2019-03-12  6:35   ` Joe Perches
2019-03-12  6:58     ` maowenan
2019-03-12  7:06       ` Joe Perches
2019-03-12  7:14       ` Julia Lawall [this message]
2019-03-12 12:02   ` Greg KH
2019-03-17 11:26 ` Greg KH
2019-03-18 13:57   ` maowenan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.DEB.2.21.1903120813460.2728@hadrien \
    --to=julia.lawall@lip6.fr \
    --cc=Larry.Finger@lwfinger.net \
    --cc=davem@davemloft.net \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=jananis37@gmail.com \
    --cc=joe@perches.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maowenan@huawei.com \
    --cc=straube.linux@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox