Received: by 2002:ac0:950c:0:0:0:0:0 with SMTP id f12csp1781828imc; Mon, 11 Mar 2019 23:59:34 -0700 (PDT) X-Google-Smtp-Source: APXvYqzxzUp0cL9s/oZ1TM59PBfXAW0MM5HWV23NkMpoRYHPK1OFJLEics0nLb5qA8gVecld66kO X-Received: by 2002:a63:e752:: with SMTP id j18mr16302516pgk.313.1552373974835; Mon, 11 Mar 2019 23:59:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552373974; cv=none; d=google.com; s=arc-20160816; b=gwD4j45j8D2Bf9ZTBMY4nXuw3sq8lINGOegIxUpHNbs+HDxUZPWA9fu9MShEWcyEWN Sk4OLyKyu3ecOwvIuaHy5cfUuwFXFmasd5XTv2mzgQpUuO5da2dCI3K3upqjsmoKzTQt FbVlTd2IqyRRUftGY23uhQIqLDjWt+PzLqor/bC/0XLeDknnhd5Pe4iMucsrTaoE+uAN Nk/MVhGgZqGbOkBBrYroWwyeS6ZLxbAJOhG4MUMNxkFdPCyBNN+NzPXx0JGkpaFmgqX5 lJSiWjkRIhP6f7HMYEh0qJ9RQacV9o4aLTKgWQximiPuNQmKrjEViTXJZ6e7IbKajJGw WscA== 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:in-reply-to :mime-version:user-agent:date:message-id:from:references:to:subject; bh=Qcqa2vWbcJEqCJ1KH6QKmkXjFdmC2Hdgt9c2C53Zwgg=; b=SZXgtmQqoGMe7Ps9yvAGzxr2gvzcvNpmEv32o1W1Rl0Lab5taX1+pg3fYzc6bEVbrd vQaMnWUK1mX1zgbwuOZ2+MMfYnPYd0onhIhRbVzbY68GvPnVCIuXUtYHZugype7k6YmL VilQ1ZptRoCD6sh9UHXHOIM0RuR8ePzyUywazNYgDspN0NUPVp02pN3JfAVaCtm7569W uhlsj9KVsbe9k2IHP/TuURP9emAgrzRaiYV7zfVe/QK6yDJz9vngbnc3//mgleSZ13vP zi/ZjNVmdwP92lwkuG/uLEAlTrZozg+Doz85iJzcCkpxM9Pkxe0dejEEa+NOFIfQ/ZMh oNlw== 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 ct9si8064720plb.341.2019.03.11.23.59.19; Mon, 11 Mar 2019 23:59:34 -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 S1727415AbfCLG6x (ORCPT + 99 others); Tue, 12 Mar 2019 02:58:53 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:4673 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727301AbfCLG6s (ORCPT ); Tue, 12 Mar 2019 02:58:48 -0400 Received: from DGGEMS403-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 95CBFB869ED5BC48720E; Tue, 12 Mar 2019 14:58:45 +0800 (CST) Received: from [127.0.0.1] (10.177.96.96) by DGGEMS403-HUB.china.huawei.com (10.3.19.203) with Microsoft SMTP Server id 14.3.408.0; Tue, 12 Mar 2019 14:58:43 +0800 Subject: Re: [PATCH net] staging: rtl8188eu: use is_zero_ether_addr() instead of memcmp() To: Joe Perches , , , , , , , , References: <20190309032600.98732-1-maowenan@huawei.com> <951c83d2-fa0d-11ed-96a9-cee620c9c096@huawei.com> From: maowenan Message-ID: <22e39cdc-6c66-f08a-f2b3-e2637e0b810b@huawei.com> Date: Tue, 12 Mar 2019 14:58:36 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.177.96.96] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. > > > > . >