Received: by 2002:ac0:950c:0:0:0:0:0 with SMTP id f12csp1787339imc; Tue, 12 Mar 2019 00:06:51 -0700 (PDT) X-Google-Smtp-Source: APXvYqwMfTN0BaX3int1NyNquL6gNgwnTtEtCB5oDHNGYkYWfJeBzjuK7IlfhXRbpCVMGOiN+wpn X-Received: by 2002:a17:902:20e3:: with SMTP id v32mr38183825plg.213.1552374411075; Tue, 12 Mar 2019 00:06:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552374411; cv=none; d=google.com; s=arc-20160816; b=qk2OmbflcqcjUfeaC7dFzaBEXvxuyA9Ty/3OlUoCKnt8FlxOhEzpmplTSsuoqSNbGG kJIHSGvDMQNywRNXoEIwJOgfeJ7qb0eL0jiGcrG+nl189RbJKo7NUnwHtkJZDEbgbKnC bZaLbRPfFVN2IcZHXqSv20x9lf1Az80X8MUEOng8pbODffXUqOyvzR2VaBj8+QZlbPdl inN5ICd1YPhIdWbvUM2VWuPTXE8bMsE/X6s/RhOQxDlX/aVOBHhXwxmGamwZTYOO/a3t aPBMw6ZhV5CnWlNGnoRfsVp49RXTesmDwTDW9pHxvV3r91lTCh4K0VXtWLBdGfb82x70 j24Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:date:to:from:subject:message-id; bh=lUKnQ2OmAv7b7wJCWLp3HEiuPnIS/Jj7Yeif+FuBNxk=; b=Ehvy3FWswxuL3bh6AvlWmzxbWl5Dwl/tXIEaSnDfLmh1jVgRFmbndPx3co/MdusWMm w6Vv5HPWzecIBgwGjndlxkY7dX0Rkv8BwvZT09QAwkTD48jaiWhBRHOEUP/8Vp8Jl0g6 8lJ8Ap0TiZcFqc55RYW3hXr0191T8rWLNNBlPZYNsPNE8/Mh+vMKOGSNyic6OLP/N77B TUr9vulys6YMSKJLoDRj7ch0IPFUsLky/8FTDTs7Uj72hq7tkF3zSmoQdcSram96DWfk HmcNKQDdyAUBxiP4ACHZq9ZXVM0pz0nlrfqKpCxgFWUUoCMXoLWU87+OQsAt57WHecjQ nyPA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e1si6671225pgs.451.2019.03.12.00.06.35; Tue, 12 Mar 2019 00:06:51 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727089AbfCLHGI (ORCPT + 99 others); Tue, 12 Mar 2019 03:06:08 -0400 Received: from smtprelay0230.hostedemail.com ([216.40.44.230]:59412 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726218AbfCLHGI (ORCPT ); Tue, 12 Mar 2019 03:06:08 -0400 Received: from filter.hostedemail.com (clb03-v110.bra.tucows.net [216.40.38.60]) by smtprelay01.hostedemail.com (Postfix) with ESMTP id C11F9100E86C5; Tue, 12 Mar 2019 07:06:06 +0000 (UTC) X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,joe@perches.com,:::::::::::::::::,RULES_HIT:41:355:379:599:973:988:989:1260:1277:1311:1313:1314:1345:1359:1381:1437:1515:1516:1518:1534:1541:1593:1594:1711:1730:1747:1777:1792:2393:2553:2559:2562:2828:2915:3138:3139:3140:3141:3142:3353:3622:3834:3865:3866:3867:3871:3873:3874:4321:5007:7875:8957:10004:10400:10481:10848:11026:11232:11657:11658:11914:12043:12048:12114:12296:12740:12760:12895:13069:13255:13311:13357:13439:14659:14721:19900:21080:21451:21627:21740:30003:30054:30069:30070:30090:30091,0,RBL:47.151.153.53:@perches.com:.lbl8.mailshell.net-62.8.0.100 64.201.201.201,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fn,MSBL:0,DNSBL:neutral,Custom_rules:0:0:0,LFtime:30,LUA_SUMMARY:none X-HE-Tag: fifth34_3523854c1452c X-Filterd-Recvd-Size: 2978 Received: from XPS-9350.home (unknown [47.151.153.53]) (Authenticated sender: joe@perches.com) by omf06.hostedemail.com (Postfix) with ESMTPA; Tue, 12 Mar 2019 07:06:05 +0000 (UTC) Message-ID: <0bee5aaaff4a4769d8f531552298feb2452f9026.camel@perches.com> Subject: Re: [PATCH net] staging: rtl8188eu: use is_zero_ether_addr() instead of memcmp() From: Joe Perches To: maowenan , 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 Date: Tue, 12 Mar 2019 00:06:04 -0700 In-Reply-To: <22e39cdc-6c66-f08a-f2b3-e2637e0b810b@huawei.com> References: <20190309032600.98732-1-maowenan@huawei.com> <951c83d2-fa0d-11ed-96a9-cee620c9c096@huawei.com> <22e39cdc-6c66-f08a-f2b3-e2637e0b810b@huawei.com> Content-Type: text/plain; charset="ISO-8859-1" User-Agent: Evolution 3.30.1-1build1 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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.