lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 12 Mar 2019 00:06:04 -0700
From:   Joe Perches <joe@...ches.com>
To:     maowenan <maowenan@...wei.com>, Larry.Finger@...inger.net,
        gregkh@...uxfoundation.org, straube.linux@...il.com,
        jananis37@...il.com, devel@...verdev.osuosl.org,
        linux-kernel@...r.kernel.org, kernel-janitors@...r.kernel.org,
        davem@...emloft.net
Subject: Re: [PATCH net] staging: rtl8188eu: use is_zero_ether_addr()
 instead of memcmp()

On Tue, 2019-03-12 at 14:58 +0800, 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 reading old documentation.
(though the "Please note:" line is from 2013)

include/linux/etherdevice.h-/**
include/linux/etherdevice.h- * is_zero_ether_addr - Determine if give Ethernet address is all zeros.
include/linux/etherdevice.h- * @addr: Pointer to a six-byte array containing the Ethernet address
include/linux/etherdevice.h- *
include/linux/etherdevice.h- * Return true if the address is all zeroes.
include/linux/etherdevice.h- *
include/linux/etherdevice.h- * Please note: addr must be aligned to u16.


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ