Received: by 2002:ac0:aed5:0:0:0:0:0 with SMTP id t21csp1392224imb; Sat, 2 Mar 2019 13:32:52 -0800 (PST) X-Google-Smtp-Source: APXvYqx8VPHh3qCw7HJSU+OxsLs1Qe0gxRonUcj0h4P5eP8LoeS7GoJbYti//JPJHUxPn8gw0lws X-Received: by 2002:a62:20d2:: with SMTP id m79mr7822308pfj.135.1551562372586; Sat, 02 Mar 2019 13:32:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551562372; cv=none; d=google.com; s=arc-20160816; b=fs0zBM4o98vz8DgmrMlswV0Za9dC/AiY5TpeZvUzZDUk18UOKoqArY47yaX84oN/vi 37D+NZwJUoqexLHBV2V/FSuf1ujih+TvGwPYQCEwb+fY6K3aeq3Gji8Aoiqlg4SmZSxY QaBbDs0QqVgvmkVqPVwbVmRQHvTScJo+IVx1kYlOfRWlwNyPgk/iYfa+3bXL62RvjvrL 6wRW6De+ezLT8TIBZvu+s5Wa95hFk8NeI0imyfe1RGt0X9SqN1WxoI26PRmwbDmKj7CN C45WlFpwh3uMPYOfL31kBHpBUKYmErS2EZniYc0CY6enXjXS1ZKcjr/l1QjKrkNrEqtB 9KVA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:content-disposition :mime-version:message-id:subject:cc:to:from:date; bh=zIiMO3UB/iZloLV5GcSaLdugjfth/EXKh55EAYLEA/A=; b=IzV0peJgEzOYlapkbrGpCDx1jxWtVi/13ppFUybjuEWHvBhxEv5a7Pf+AJR3K953fc 30CqWeJ2k29+3tqR4ic56a+c11m9pletMTOjLRp+8gZ2TtEpaezPJFogUp24QTsYSJeF 1GGklRyer4qgGj6tLe9ndKKkx9Rr67vB07X7JYN93o5gPnSvJCq9CahZxnTVO+z/Nm+v KtTT/VTtABUKMfzKXPLzj8Z4CVamqj8NYcAcBr1E7ldlYhyyAMLJIWq9AuiEewXhZDGp EYxEkv558oUYGYCn2TISWQKKUHqzy57KvZKpdKVzbV8IAMj3xhcH9px4BtTkKQphmfWN Khcg== 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 i3si1370322pgq.282.2019.03.02.13.32.35; Sat, 02 Mar 2019 13:32:52 -0800 (PST) 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 S1726772AbfCBVcP (ORCPT + 99 others); Sat, 2 Mar 2019 16:32:15 -0500 Received: from gateway20.websitewelcome.com ([192.185.70.14]:18839 "EHLO gateway20.websitewelcome.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726603AbfCBVcP (ORCPT ); Sat, 2 Mar 2019 16:32:15 -0500 X-Greylist: delayed 1283 seconds by postgrey-1.27 at vger.kernel.org; Sat, 02 Mar 2019 16:32:15 EST Received: from cm13.websitewelcome.com (cm13.websitewelcome.com [100.42.49.6]) by gateway20.websitewelcome.com (Postfix) with ESMTP id 8990D400C74DE for ; Sat, 2 Mar 2019 15:10:51 -0600 (CST) Received: from gator4166.hostgator.com ([108.167.133.22]) by cmsmtp with SMTP id 0BuFhnb1aYTGM0BuFh3qJ7; Sat, 02 Mar 2019 15:10:51 -0600 X-Authority-Reason: nr=8 Received: from [189.250.88.58] (port=51114 helo=embeddedor) by gator4166.hostgator.com with esmtpa (Exim 4.91) (envelope-from ) id 1h0BuE-0007Cd-6i; Sat, 02 Mar 2019 15:10:50 -0600 Date: Sat, 2 Mar 2019 15:10:46 -0600 From: "Gustavo A. R. Silva" To: Felix Fietkau , Lorenzo Bianconi , Kalle Valo , "David S. Miller" , Matthias Brugger Cc: linux-wireless@vger.kernel.org, netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org, "Gustavo A. R. Silva" Subject: [mt76/mt7603/mac] Question about missing variable assignment Message-ID: <20190302211046.GA20268@embeddedor.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.9.4 (2018-02-28) X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - gator4166.hostgator.com X-AntiAbuse: Original Domain - vger.kernel.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - embeddedor.com X-BWhitelist: no X-Source-IP: 189.250.88.58 X-Source-L: No X-Exim-ID: 1h0BuE-0007Cd-6i X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: (embeddedor) [189.250.88.58]:51114 X-Source-Auth: gustavo@embeddedor.com X-Email-Count: 10 X-Source-Cap: Z3V6aWRpbmU7Z3V6aWRpbmU7Z2F0b3I0MTY2Lmhvc3RnYXRvci5jb20= X-Local-Domain: yes Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi all, The following piece of code in drivers/net/wireless/mediatek/mt76/mt7603/mac.c is missing a variable assignment before line 1058. Notice that there is a potential execution path in which variable *i* is compared against magic number 15 at line 1075 without being initialized previously (this was reported by Coverity): 1055 out: 1056 final_rate_flags = info->status.rates[final_idx].flags; 1057 1058 switch (FIELD_GET(MT_TX_RATE_MODE, final_rate)) { 1059 case MT_PHY_TYPE_CCK: 1060 cck = true; 1061 /* fall through */ 1062 case MT_PHY_TYPE_OFDM: 1063 if (dev->mt76.chandef.chan->band == NL80211_BAND_5GHZ) 1064 sband = &dev->mt76.sband_5g.sband; 1065 else 1066 sband = &dev->mt76.sband_2g.sband; 1067 final_rate &= GENMASK(5, 0); 1068 final_rate = mt7603_get_rate(dev, sband, final_rate, cck); 1069 final_rate_flags = 0; 1070 break; 1071 case MT_PHY_TYPE_HT_GF: 1072 case MT_PHY_TYPE_HT: 1073 final_rate_flags |= IEEE80211_TX_RC_MCS; 1074 final_rate &= GENMASK(5, 0); 1075 if (i > 15) 1076 return false; 1077 break; 1078 default: 1079 return false; 1080 } My guess is that such missing assignment should be something similar to the one at line 566: i = FIELD_GET(MT_RXV1_TX_RATE, rxdg0); but I'm not sure what the proper arguments for macro FIELD_GET should be. This code was introduced by commit c8846e1015022d2531ac4c895783e400b3e5babe What do you think? Thanks -- Gustavo