Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp455730img; Mon, 18 Mar 2019 06:59:57 -0700 (PDT) X-Google-Smtp-Source: APXvYqzfDiWA8bUrP7WRvimV8sY3ItCerJ8WVxaD5Ej5HRd1v5cC7sQmG3BJ+0smQ8KTnlI3yxSe X-Received: by 2002:aa7:920b:: with SMTP id 11mr1245117pfo.3.1552917597202; Mon, 18 Mar 2019 06:59:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552917597; cv=none; d=google.com; s=arc-20160816; b=lYjAHFFEVSyBKPBg4DuYfZ9LL+udFY82zu635h+/21dzBk0WB5Trku64Jkml1ei/Mz mlJnaXgskuIrxubAdjKeGdaz6Oy3AkT+mbHPbELN4eTbvpdxqX4AlpFk4DcTgqdlc1Fc 0ntzfvV2GKedKzyLwaNe1gh8ucLcU339akOSVGbHdCoQazD/VzpLNpazWVVP5xRqOdpE L+nz3Zwtyvzoc2PkFQHrTOHKzckFcBu+EnOfa+wEGToD+KmrvVTD64IK+psvMwZo6DdQ qHQwN4zU3zOAWZmdpcbjYAYCIOqRXTRJfjU/PieFRyhR+ZbaK79Z1kDMt3BwEew2ngaZ zpZw== 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:cc:references:to :subject; bh=k699pDZhOHLqmwCfRPgWg7TzKs2wRfxQVyLMOMWxrdk=; b=kFLny12P2X0AQ7mdNF06pKx0gfOQ+773hRerJ24VF3HhOrAVGDefTriK2UtIfeR8LL FNCss1bYK8NBlyAHl0iSFYK6OlhqmEMs5YQtUQql82v1n+jfgp0NhZ35TQn0DkH6ilBS gr9NsTJfwWVR9AQtyLURyxDOc22SqVAmUNPrwUIcqBoqRX/rtzzP4/wRVnNinkkrzkKo Ayq9qBi30DtcsXiXVz4sVDggQJHMen0Uc6/UIxgjbBMfNg2ozDniSPB2TZAXCqnFAYSc 1uTowEYr37OiILghWMOTVEsrudAB6DQurKuEQJaUbRvZbCAHzpDxwT6mmLh0rVDB2v/X oRLg== 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 g96si9531781plb.168.2019.03.18.06.59.42; Mon, 18 Mar 2019 06:59:57 -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 S1727647AbfCRN50 (ORCPT + 99 others); Mon, 18 Mar 2019 09:57:26 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:4702 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726626AbfCRN50 (ORCPT ); Mon, 18 Mar 2019 09:57:26 -0400 Received: from DGGEMS404-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id 11874AE1C3FF3EE5510F; Mon, 18 Mar 2019 21:57:22 +0800 (CST) Received: from [127.0.0.1] (10.177.96.96) by DGGEMS404-HUB.china.huawei.com (10.3.19.204) with Microsoft SMTP Server id 14.3.408.0; Mon, 18 Mar 2019 21:57:17 +0800 Subject: Re: [PATCH net] staging: rtl8188eu: use is_zero_ether_addr() instead of memcmp() To: Greg KH References: <20190309032600.98732-1-maowenan@huawei.com> <20190317112647.GG4614@kroah.com> CC: , , , , , , From: maowenan Message-ID: Date: Mon, 18 Mar 2019 21:57:14 +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: <20190317112647.GG4614@kroah.com> 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/17 19:26, Greg KH wrote: > On Sat, Mar 09, 2019 at 11:26:00AM +0800, Mao Wenan wrote: >> Using is_zero_ether_addr() instead of directly use >> memcmp() to determine if the ethernet address is all >> zeros. >> >> Signed-off-by: Mao Wenan >> --- >> drivers/staging/rtl8188eu/core/rtw_mlme.c | 3 +-- >> 1 file changed, 1 insertion(+), 2 deletions(-) >> >> diff --git a/drivers/staging/rtl8188eu/core/rtw_mlme.c b/drivers/staging/rtl8188eu/core/rtw_mlme.c >> index 714f7a70ed64..beae367df93b 100644 >> --- 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)) { > > As Joe said, you have to prove that this is properly aligned before you > can call this function. Please do so. The previous function to call rtw_find_network(), has been aligned for parameter 'addr', because it has been defined an arry[6]; such as unsigned char MacAddress[ETH_ALEN] in struct wlan_bssid_ex; 179 struct wlan_bssid_ex { 180 u32 Length; 181 unsigned char MacAddress[ETH_ALEN]; 182 u8 Reserved[2];/* 0]: IS beacon frame */ 183 struct ndis_802_11_ssid ssid; 184 u32 Privacy; 185 NDIS_802_11_RSSI Rssi;/* in dBM,raw data ,get from PHY) */ 186 enum NDIS_802_11_NETWORK_TYPE NetworkTypeInUse; 187 struct ndis_802_11_config Configuration; 188 enum ndis_802_11_network_infra InfrastructureMode; 189 unsigned char SupportedRates[NDIS_802_11_LENGTH_RATES_EX]; 190 struct wlan_phy_info PhyInfo; 191 u32 ie_length; 192 u8 ies[MAX_IE_SZ]; /* timestamp, beacon interval, and 193 * capability information) 194 */ 195 } __packed; rtw_survey_event_callback->rtw_find_network(&pmlmepriv->scanned_queue, pnetwork->MacAddress); struct wlan_bssid_ex *pnetwork; > > thanks, > > greg k-h > > . >