Received: by 2002:a05:6a10:a852:0:0:0:0 with SMTP id d18csp372331pxy; Wed, 5 May 2021 04:27:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyBeEeKVGyX2PYU7FIge/o/m4cXiGgPl9oTN4qWW1xkYv9z6g5LY6hmCLGV7cSPlWSkjaHP X-Received: by 2002:a62:ea1a:0:b029:27a:bcea:5d3d with SMTP id t26-20020a62ea1a0000b029027abcea5d3dmr28293700pfh.69.1620214051377; Wed, 05 May 2021 04:27:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620214051; cv=none; d=google.com; s=arc-20160816; b=xvlGPjYqbVnT10jtiVuDHjw9ubSur9L5ebEkx9Rs38sHoQNWXHtldmxcbTk6DBmhF/ PH4XZSeiHWjAu6DnfdVDGP/3tPD3ck5f0xG2dZZJaIKfVhVb36sK6YRQY+hUB2mfba28 /yFE3hgFHWG9mUuBJXCqYkmFd5ppasJdLiwr2mfDzZt3D5M2mn0XvJklnWzEpDLPjuF0 AQJ6zhaX2pLAT3GrgtOySRX32c8mBgZiuN/JZhyr6hZA3r572CPAh9FuhWGYaXmIzNOO JT26wVjssA4CGKA48gi4g0levLS29e7lj9G+mkV6DCbWMHEgMPEedfH1O/GUmlC5foAz 8O5w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=hffqOq3YCP4M39yMWPMnYY8Ldp9nls3UMIU5xjslAeg=; b=pSJCMPBiAIIY/7BtrXp0PrkN0S2e2FRDIJmPrBSCfQ0ICisg3X1wWTTLZTGtcDOF5S XVScwUpXsceKwoE9kHke9BWV3weC7oXSQH7cKi3D3xmqek7+IFw9ZqFqN2EQ72rNGrZb BUybA5IBeAY8VJrf2WLO6WZM/9RceEi54enIugnkZessOO/P/loVoZrldhbpNnf/aIzA 6oZ35lLny4hO1L2vKfcAyf0peQPsP/Mr1LRm+kbnCXye/URdbKOqeysKOdwt26ma38V6 TpmFLpP9Z7euUtgycq7wDG0DR3wDeLEj+zdVkMNnMBLmsi6LVWv8s8E1WDSUEzwxHxCl jOyw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=XHnAjiaD; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id fw7si20456689pjb.2.2021.05.05.04.27.06; Wed, 05 May 2021 04:27:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=XHnAjiaD; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232880AbhEELY5 (ORCPT + 99 others); Wed, 5 May 2021 07:24:57 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:49217 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230001AbhEELY5 (ORCPT ); Wed, 5 May 2021 07:24:57 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1620213840; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=hffqOq3YCP4M39yMWPMnYY8Ldp9nls3UMIU5xjslAeg=; b=XHnAjiaDq0iwGGx+vK6zvo423qUkRxf+pf1dLwXI5e3WkcA6lfbroUiuZKQ71DSrxFKdg9 2ym+OruPRgei8ApddzW3QoBokSHF0BiYomOaQ81M9H66AGCHKRsHTjgd/pH6SBb1i4bUnD WnBdcfkDK3sQsKuYdWq+0OvXZZ+/YjA= Received: from mail-pf1-f200.google.com (mail-pf1-f200.google.com [209.85.210.200]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-64-dfrZy1g0PZ-pQ3_EVH2bMg-1; Wed, 05 May 2021 07:23:59 -0400 X-MC-Unique: dfrZy1g0PZ-pQ3_EVH2bMg-1 Received: by mail-pf1-f200.google.com with SMTP id j184-20020a6255c10000b0290214249d921cso1213973pfb.17 for ; Wed, 05 May 2021 04:23:59 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=hffqOq3YCP4M39yMWPMnYY8Ldp9nls3UMIU5xjslAeg=; b=JSnBPIWekiifNi18t3gjcSiAY54j5rSMAIxoDvRF/v7CKpnWAGv0T+sLXqelQAc03F qiZvqffUaCgmyVW6Vw7wVLcNCkCWbtntWoiXveU25fthho2k4VGjA4o6JOTr1KeCzM+O LSWKDtpqOPcW5tONZpWqbGads5vfMhvI6r8Nouew7CFoiiSuBczsj9oiEEHx4jcEnq5F tqDX1gpUBWR+2xeOAQyIih2I5GVDmYnxlzOEre/A7/hkfDEjHswmv8rkv2TNJ9v9Fxm4 YOTz5QWeBrqaC23j11UF9KmQZvxp8kaI5mZ2eztT5tJN2UrlXild6fT3RcShrUZ2N3TE uAkA== X-Gm-Message-State: AOAM532L0iObuQjY9DU0Kci7UItzJvfUdcecnmR1TtkkE8dVGZzWV0Jo wCbzl2QYJZPKC021uMg0852L4ptmT9GK5RsQwPgqfuKjM43v8gxCEoQoHY1T/jS/CWE9pMAjAQF AK78V+noeVmN4AHrbQk7ezzD0xOUzhpwuEQ2sVnvf3Gc= X-Received: by 2002:a62:808b:0:b029:252:eddc:afb0 with SMTP id j133-20020a62808b0000b0290252eddcafb0mr29213459pfd.41.1620213837778; Wed, 05 May 2021 04:23:57 -0700 (PDT) X-Received: by 2002:a62:808b:0:b029:252:eddc:afb0 with SMTP id j133-20020a62808b0000b0290252eddcafb0mr29213442pfd.41.1620213837502; Wed, 05 May 2021 04:23:57 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Inigo Huguet Date: Wed, 5 May 2021 13:23:46 +0200 Message-ID: Subject: Re: rtlwifi: potential bugs To: pkshih@realtek.com, linux-wireless@vger.kernel.org Cc: Ivan Vecera Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org On Fri, Apr 23, 2021 at 2:56 PM Inigo Huguet wrote: > > Hello, > > Executing some static analysis on the kernel, we've got this results > affecting rtlwifi drivers: > > Error: IDENTICAL_BRANCHES (CWE-398): [#def212] > kernel-5.11.0-0.rc7.151/linux-5.11.0-0.rc7.151.el9.x86_64/drivers/net/wir= eless/realtek/rtlwifi/btcoexist/halbtc8821a2ant.c:2813: > identical_branches: The same code is executed regardless of whether > "bt_rssi_state =3D=3D BTC_RSSI_STATE_HIGH || bt_rssi_state =3D=3D > BTC_RSSI_STATE_STAY_HIGH" is true, because the 'then' and 'else' > branches are identical. Should one of the branches be modified, or the > entire 'if' statement replaced? > # 2811| } > # 2812| > # 2813|-> if ((bt_rssi_state =3D=3D BTC_RSSI_STATE_HIGH) || > # 2814| (bt_rssi_state =3D=3D BTC_RSSI_STATE_STAY_HIGH)) { > # 2815| btc8821a2ant_ps_tdma(btcoexist, NORMAL_EXEC, true, 23); > > Error: IDENTICAL_BRANCHES (CWE-398): [#def213] > kernel-5.11.0-0.rc7.151/linux-5.11.0-0.rc7.151.el9.x86_64/drivers/net/wir= eless/realtek/rtlwifi/btcoexist/halbtc8821a2ant.c:2947: > identical_branches: The same code is executed regardless of whether > "bt_rssi_state =3D=3D BTC_RSSI_STATE_HIGH || bt_rssi_state =3D=3D > BTC_RSSI_STATE_STAY_HIGH" is true, because the 'then' and 'else' > branches are identical. Should one of the branches be modified, or the > entire 'if' statement replaced? > # 2945| } > # 2946| > # 2947|-> if ((bt_rssi_state =3D=3D BTC_RSSI_STATE_HIGH) || > # 2948| (bt_rssi_state =3D=3D BTC_RSSI_STATE_STAY_HIGH)) > # 2949| btc8821a2ant_ps_tdma(btcoexist, NORMAL_EXEC, true, 26); > > Error: IDENTICAL_BRANCHES (CWE-398): [#def214] > kernel-5.11.0-0.rc7.151/linux-5.11.0-0.rc7.151.el9.x86_64/drivers/net/wir= eless/realtek/rtlwifi/btcoexist/halbtc8821a2ant.c:3135: > identical_branches: The same code is executed regardless of whether > "wifi_bw =3D=3D BTC_WIFI_BW_LEGACY" is true, because the 'then' and 'else= ' > branches are identical. Should one of the branches be modified, or the > entire 'if' statement replaced? > # 3133| btcoexist->btc_get(btcoexist, BTC_GET_U4_WIFI_BW, &wifi_bw); > # 3134| > # 3135|-> if (wifi_bw =3D=3D BTC_WIFI_BW_LEGACY) { > # 3136| /* for HID at 11b/g mode */ > # 3137| btc8821a2ant_coex_table(btcoexist, NORMAL_EXEC, 0x55ff55ff, > > Error: IDENTICAL_BRANCHES (CWE-398): [#def215] > kernel-5.11.0-0.rc7.151/linux-5.11.0-0.rc7.151.el9.x86_64/drivers/net/wir= eless/realtek/rtlwifi/btcoexist/halbtc8821a2ant.c:3324: > identical_branches: The same code is executed regardless of whether > "bt_rssi_state =3D=3D BTC_RSSI_STATE_HIGH || bt_rssi_state =3D=3D > BTC_RSSI_STATE_STAY_HIGH" is true, because the 'then' and 'else' > branches are identical. Should one of the branches be modified, or the > entire 'if' statement replaced? > # 3322| } > # 3323| > # 3324|-> if ((bt_rssi_state =3D=3D BTC_RSSI_STATE_HIGH) || > # 3325| (bt_rssi_state =3D=3D BTC_RSSI_STATE_STAY_HIGH)) { > # 3326| btc8821a2ant_ps_tdma(btcoexist, NORMAL_EXEC, true, 23); > > > In my opinion, they seem to be real bugs. However, it's very difficult > to imagine what actions must be taken on each branch of the if-else > because they strongly depend on magic numbers, which are different > configurations for the hw, I guess. > > Can the maintainers confirm if these are real bugs and see how to fix the= m? > > Regards > -- > =C3=8D=C3=B1igo Huguet Hello, A few weeks ago I sent the message above notifying a potential bug in rtlwifi module. I just wanted to be sure that it has been received. Can the maintainers acknowledge whether they have seen it? Thanks! --=20 =C3=8D=C3=B1igo Huguet