Received: by 2002:ac0:950c:0:0:0:0:0 with SMTP id f12csp1793249imc; Tue, 12 Mar 2019 00:15:52 -0700 (PDT) X-Google-Smtp-Source: APXvYqxVYbvMvSj8yr8U5i+DwVN1dvQbfOjZGlcAshhXqTi8lP/rE7Tu6H36KRU0b8e1opNMpoF5 X-Received: by 2002:a17:902:b68d:: with SMTP id c13mr13951511pls.46.1552374952237; Tue, 12 Mar 2019 00:15:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552374952; cv=none; d=google.com; s=arc-20160816; b=Egfs0o+lsJNasjb1Hli+Jwtkerr5U38OwZOussTyHVFBxeSJ85S5vFLO+ZjSofViR/ YSlZSG3zx9P1X7LtWPXWLnA1cVgV4RjMQQ9zLE+fei2N5e0HWlH+iEShamZ01zgLaDhC LcsTd3CAlN8pTpU8lwhgdNLXV64mf93mys6KPil1+WvvBx8oJehNe82dWepTfSpCdQvb mf6aKQ2twUIKjMDUM8ea/JiiZqlNSa6PnzRm4ZPEerxvkyM0lb2iUmnOEXs/N2Wff5Ti G4xYa/z1UI48YcBQ+IjPjDuG2vYBWau75PwVPXJfUeYLOeM4JiGDFzdzFJkS5SUiJRP8 4YlQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date; bh=W1ykr9iKTDLN2NvpiGS7tlbJ8VUby8F4fJFKAaHTgKM=; b=XsqgB8yydGJPXP4pRKLmnYQL0EBItfcQSy9nj2oMcKRofQDvupYA80hw174lOXVIPi cFWIgGWLfXLEgew/BXqLYMdoz37gSFSTdlrmx0E9oihAbgcxAOGv0bqnz6FZm067vIQH Xp+d+2RKi5hzcb8eBnEUzaKf1obwsrPJKdy8MfbmxfLIknl9ENhWGGKDeDQ6RHIXmYZw HbWI/CCggiDzEWs23RIK1vJahXvHEgfT6bgn1kik/pJQUEV4QxaaEpvg2NAW2v1BKK2l 1t/9jALltoCC3fuzWW4D9wEKrTCj/URo6OnDa0dGBcbVUrjRefQkej6GaG74oxYYw2ej BmsQ== 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 c11si7063163pga.350.2019.03.12.00.15.35; Tue, 12 Mar 2019 00:15:52 -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 S1727411AbfCLHOl (ORCPT + 99 others); Tue, 12 Mar 2019 03:14:41 -0400 Received: from mail3-relais-sop.national.inria.fr ([192.134.164.104]:28843 "EHLO mail3-relais-sop.national.inria.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727225AbfCLHOl (ORCPT ); Tue, 12 Mar 2019 03:14:41 -0400 X-IronPort-AV: E=Sophos;i="5.58,470,1544482800"; d="scan'208";a="298910482" Received: from abo-58-107-68.mrs.modulonet.fr (HELO hadrien) ([85.68.107.58]) by mail3-relais-sop.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 12 Mar 2019 08:14:38 +0100 Date: Tue, 12 Mar 2019 08:14:37 +0100 (CET) From: Julia Lawall X-X-Sender: jll@hadrien To: maowenan cc: Joe Perches , 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() In-Reply-To: <22e39cdc-6c66-f08a-f2b3-e2637e0b810b@huawei.com> Message-ID: References: <20190309032600.98732-1-maowenan@huawei.com> <951c83d2-fa0d-11ed-96a9-cee620c9c096@huawei.com> <22e39cdc-6c66-f08a-f2b3-e2637e0b810b@huawei.com> User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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