Received: by 2002:a05:7412:d008:b0:f9:6acb:47ec with SMTP id bd8csp383041rdb; Tue, 19 Dec 2023 22:48:11 -0800 (PST) X-Google-Smtp-Source: AGHT+IGPiFB9TQNT9TGONmgy3f6YZaxgGJvQvagtmWrDzTwSQxUB6FToNr6/pHyv+R/8NybbapRN X-Received: by 2002:a05:6808:120e:b0:3b8:b063:a1c7 with SMTP id a14-20020a056808120e00b003b8b063a1c7mr22798867oil.81.1703054891682; Tue, 19 Dec 2023 22:48:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703054891; cv=none; d=google.com; s=arc-20160816; b=nsupMXWEAj4RwwKF6dIrfVCG9EXEzsD4kEgLLx6PdB9OG5S/vQM3LLuKqaGKB+C0FY +Uk0nBpDIxsJqL/atpCtj1G9MjkXAqLW9+fOgFRM8hQ/s00wrzDzAplhWyHWUDRrMyN3 dYSzx1V4wYbUJQyM+lxXL46ZKFSB3TItAKa58h5iizALxbai8jFhMtYNhjkhx+0QirGB YXHIF36vlkeP7MbwfAlpRwLvyrAV53vs3+giLWeLWgp6Hl0zJ3yNYw4D6P/50KQCqxDP ZI1PDNKq1Ym0HL6zqsryAVglZnTQjVsh+VDuoA2UOyxJCJho0PpIvc6qTLdA5h8C8x3r CaNQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :content-transfer-encoding:content-language:accept-language :in-reply-to:references:message-id:date:thread-index:thread-topic :subject:cc:to:from; bh=BncnNJ7TRvYD3tvj8lhRF5NNQiqJgHlk7AwoYtaiVfE=; fh=AN+rFk1qzKxY7tzcgfPFpjxGNdsVRDY4f6K+eECudkI=; b=yqJLzIvg7Dm0RqdfJogsTtz7/uDuZtdWxkyAW3pfgwhp2NQ4Xdch1z5YlfjENNovKZ WCU56zvwbHAu7nvaN8ozvYAMTaQxYUzosB8YI+xRrXKrDhKIyQRlenhzCjdJSVM4hRco duAS6hOr0osO94gaHDS6dMLPU4tEObqUtfEbQMOoQaUCLfOMyMQGNFOr9vBgjmAtqD+w 2xyPsKvB7O1RacG9PKnSa/6XN24BFxlBX7Y+xQM/KbqXCfs4F++6s+fWwkC67sw+tvLN D5X+uVeJ6QTKJ+UoIWKp7gz/+48egMQtnbKTqLu6m2054hUtWHAi3IZlU/5tfV03jTb2 Oi7Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-wireless+bounces-1069-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-wireless+bounces-1069-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id fa27-20020a056a002d1b00b006d807d08482si4472465pfb.375.2023.12.19.22.48.11 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Dec 2023 22:48:11 -0800 (PST) Received-SPF: pass (google.com: domain of linux-wireless+bounces-1069-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-wireless+bounces-1069-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-wireless+bounces-1069-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id DE978B2186F for ; Wed, 20 Dec 2023 06:48:06 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D94F1125CB; Wed, 20 Dec 2023 06:48:01 +0000 (UTC) X-Original-To: linux-wireless@vger.kernel.org Received: from rtits2.realtek.com.tw (rtits2.realtek.com [211.75.126.72]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EF0F6171AE; Wed, 20 Dec 2023 06:47:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=realtek.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=realtek.com X-SpamFilter-By: ArmorX SpamTrap 5.78 with qID 3BK6lpqL7532004, This message is accepted by code: ctloc85258 Received: from mail.realtek.com (rtexh36506.realtek.com.tw[172.21.6.27]) by rtits2.realtek.com.tw (8.15.2/2.95/5.92) with ESMTPS id 3BK6lpqL7532004 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 20 Dec 2023 14:47:52 +0800 Received: from RTEXDAG01.realtek.com.tw (172.21.6.100) by RTEXH36506.realtek.com.tw (172.21.6.27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.17; Wed, 20 Dec 2023 14:47:52 +0800 Received: from RTEXMBS04.realtek.com.tw (172.21.6.97) by RTEXDAG01.realtek.com.tw (172.21.6.100) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.7; Wed, 20 Dec 2023 14:47:51 +0800 Received: from RTEXMBS04.realtek.com.tw ([fe80::40c2:6c24:2df4:e6c7]) by RTEXMBS04.realtek.com.tw ([fe80::40c2:6c24:2df4:e6c7%5]) with mapi id 15.01.2375.007; Wed, 20 Dec 2023 14:47:51 +0800 From: Ping-Ke Shih To: Su Hui , "kvalo@kernel.org" CC: "linux-wireless@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "kernel-janitors@vger.kernel.org" Subject: RE: [PATCH wireless-next 01/11] wifi: rtlwifi: add calculate_bit_shift() Thread-Topic: [PATCH wireless-next 01/11] wifi: rtlwifi: add calculate_bit_shift() Thread-Index: AQHaMki42VUjo40x+EmO6M2GdlhuqrCxuxhA Date: Wed, 20 Dec 2023 06:47:51 +0000 Message-ID: References: <20231219065739.1895666-1-suhui@nfschina.com> <20231219065739.1895666-2-suhui@nfschina.com> In-Reply-To: <20231219065739.1895666-2-suhui@nfschina.com> Accept-Language: en-US, zh-TW Content-Language: zh-TW x-kse-serverinfo: RTEXDAG01.realtek.com.tw, 9 x-kse-antispam-interceptor-info: fallback x-kse-antivirus-interceptor-info: fallback Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-KSE-AntiSpam-Interceptor-Info: fallback > -----Original Message----- > From: Su Hui > Sent: Tuesday, December 19, 2023 2:57 PM > To: Ping-Ke Shih ; kvalo@kernel.org > Cc: Su Hui ; linux-wireless@vger.kernel.org; linux-ke= rnel@vger.kernel.org; > kernel-janitors@vger.kernel.org > Subject: [PATCH wireless-next 01/11] wifi: rtlwifi: add calculate_bit_shi= ft() >=20 > There are many same functions like _rtl88e_phy_calculate_bit_shift(), > _rtl92c_phy_calculate_bit_shift() and so on. And these functions can > cause undefined bitwise shift behavior. Add calculate_bit_shift() to > replace them and fix undefined behavior in subsequent patches. >=20 > Signed-off-by: Su Hui Acked-by: Ping-Ke Shih > --- > drivers/net/wireless/realtek/rtlwifi/wifi.h | 7 +++++++ > 1 file changed, 7 insertions(+) >=20 > diff --git a/drivers/net/wireless/realtek/rtlwifi/wifi.h b/drivers/net/wi= reless/realtek/rtlwifi/wifi.h > index 31a481f43a07..5d842cc394aa 100644 > --- a/drivers/net/wireless/realtek/rtlwifi/wifi.h > +++ b/drivers/net/wireless/realtek/rtlwifi/wifi.h > @@ -3069,4 +3069,11 @@ static inline struct ieee80211_sta *rtl_find_sta(s= truct ieee80211_hw *hw, > return ieee80211_find_sta(mac->vif, mac_addr); > } >=20 > +static inline u32 calculate_bit_shift(u32 bitmask) > +{ > + if (WARN_ON_ONCE(!bitmask)) > + return 0; > + > + return __ffs(bitmask); > +} > #endif Basically, this patchset is to change from below example to above one.=20 static u32 _rtl92d_phy_calculate_bit_shift(u32 bitmask) { u32 i =3D ffs(bitmask); return i ? i - 1 : 32; } And, bitmask is expected not 0, so all are fine to me.=20 (I don't reply all patches one-by-one to bother people) Ping-Ke