Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp413145rwb; Tue, 6 Dec 2022 23:36:27 -0800 (PST) X-Google-Smtp-Source: AA0mqf6V4KupXbPFkYVTGyWiwEyZjTzhS2W81YtALtpXkf8A51PqN2oEolohZFjvZ9YrHGzOYvXN X-Received: by 2002:a17:906:179b:b0:7c0:ae1c:3eb7 with SMTP id t27-20020a170906179b00b007c0ae1c3eb7mr22361958eje.510.1670398587079; Tue, 06 Dec 2022 23:36:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670398587; cv=none; d=google.com; s=arc-20160816; b=gzDzbQXOSebrbGiajJnH1nbW4j2kr0cggHLxnRaydwmO/0hnXgswl4oqrNkUvL1We2 2Nsm5gIlkGF+e4dvqm4qGj4Z7tYNMZna8urKQ9iBwKsKh14L4M1j/W6gEHkz0TQ8Upl+ 7z4IiqnTcP5/rZTzyNfzK409cEHI20M373z+3u9aabMCkQpakBzYlMOZqxW9x/PBCd8I 1rS8gzMDWFdV6RyBicyo67hWz9/XROl73kMtSWH6FuTTQQmcevYyrfbRyNiMxavsRpZK s5dEwShDeZX1L/7q5ZIgfmxEY/eatv4uD7/Qz3b/+1YLOOYoxK4WdrlUCMjEHgs4JmOL +8Rg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from :dkim-signature; bh=aqnNrSjyLbOJhKH4QPr/+TJITVaI6eC+HBJYZZfcSwU=; b=jFSwsPp0YuIK8mtYSS1LrG3cHdQ/YPnDZ5N0VTyajjQp1NpK0ih24alSziVgcy6IUV wmuQFPFa9ky08K5Hfdg1b390ITcgyF6ZmGez8hxdw/x6QmPcvsUfZ5rBdqQM8KboUhz7 crpTy7rDwG8X/Xd6Heey5DDb6YLqgSWaOHThQz6d2wYxNf0SjflfcKiLBF+Cyc/IBKTG x2grW0WrqqSsjt4EvWyxNY2fdBMio6EG6gfm0izjkvzTSeXJndBSXy/dCrrokvyQwjLj tgtrA5ktWNpS/geZSLk+2Hlbl5Zs3sL1bTAos8B6RDy3NfLlNIQXSPCHQbKz/pXRxqaI BXHQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=AlCXFuiR; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k14-20020a170906a38e00b007c0d7aca43esi7245822ejz.974.2022.12.06.23.36.06; Tue, 06 Dec 2022 23:36:26 -0800 (PST) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=AlCXFuiR; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229602AbiLGHaW (ORCPT + 66 others); Wed, 7 Dec 2022 02:30:22 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56970 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229456AbiLGHaU (ORCPT ); Wed, 7 Dec 2022 02:30:20 -0500 Received: from mailgw01.mediatek.com (unknown [60.244.123.138]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 738AE27B04 for ; Tue, 6 Dec 2022 23:30:12 -0800 (PST) X-UUID: 0db81a5d8c874fccb0dbed3c5e9ac882-20221207 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Type:MIME-Version:Message-ID:Date:Subject:CC:To:From; bh=aqnNrSjyLbOJhKH4QPr/+TJITVaI6eC+HBJYZZfcSwU=; b=AlCXFuiRq2TZjoL8NJwSp40waK6NH9HulFpbocgldo99fX1LLq8CQtMCYHxFTVbGb7BPeZx+lHeX3GWeQgBARHroDV3g++IZLsAoKIRpIFD9JlrXzWrQnESdj5wLdr7uRgfpIMOPg0/lLBMeHV8tPBCZmEso835d/i3b9BcU6E4=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.14,REQID:f2ee0617-93b1-48be-8efb-feceb187f6cd,IP:0,U RL:0,TC:0,Content:0,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTION: release,TS:0 X-CID-META: VersionHash:dcaaed0,CLOUDID:403ce3d1-652d-43fd-a13a-a5dd3c69a43d,B ulkID:nil,BulkQuantity:0,Recheck:0,SF:102,TC:nil,Content:0,EDM:-3,IP:nil,U RL:0,File:nil,Bulk:nil,QS:nil,BEC:nil,COL:0 X-UUID: 0db81a5d8c874fccb0dbed3c5e9ac882-20221207 Received: from mtkexhb01.mediatek.inc [(172.21.101.102)] by mailgw01.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 166255504; Wed, 07 Dec 2022 15:30:08 +0800 Received: from mtkmbs13n2.mediatek.inc (172.21.101.108) by mtkmbs13n2.mediatek.inc (172.21.101.108) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.792.15; Wed, 7 Dec 2022 15:30:07 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkmbs13n2.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.792.15 via Frontend Transport; Wed, 7 Dec 2022 15:30:07 +0800 From: Ryder Lee To: Felix Fietkau , CC: Lorenzo Bianconi , Shayne Chen , Evelyn Tsai , , Ryder Lee Subject: [PATCH 1/2] wifi: mt76: mt7996: fix unintended sign extension of mt7996_hw_queue_read() Date: Wed, 7 Dec 2022 15:30:04 +0800 Message-ID: X-Mailer: git-send-email 2.18.0 MIME-Version: 1.0 Content-Type: text/plain X-MTK: N X-Spam-Status: No, score=0.5 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAY_BE_FORGED,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS, T_SPF_TEMPERROR,UNPARSEABLE_RELAY autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org In the expression "map[i].qid << 24" starts as u8, but is promoted to "signed int", then sign-extended to type "unsigned long", which is not intended. Cast to u32 to avoid the sign extension. Reported-by: coverity-bot Addresses-Coverity-ID: 1527813 ("Integer handling issues") Fixes: 98686cd21624 ("wifi: mt76: mt7996: add driver for MediaTek Wi-Fi 7 (802.11be) devices") Signed-off-by: Ryder Lee --- drivers/net/wireless/mediatek/mt76/mt7996/debugfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7996/debugfs.c b/drivers/net/wireless/mediatek/mt76/mt7996/debugfs.c index 99b23aef53a5..3d4fbbbcc206 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7996/debugfs.c +++ b/drivers/net/wireless/mediatek/mt76/mt7996/debugfs.c @@ -457,7 +457,7 @@ mt7996_hw_queue_read(struct seq_file *s, u32 size, if (val & BIT(map[i].index)) continue; - ctrl = BIT(31) | (map[i].pid << 10) | (map[i].qid << 24); + ctrl = BIT(31) | (map[i].pid << 10) | ((u32)map[i].qid << 24); mt76_wr(dev, MT_FL_Q0_CTRL, ctrl); head = mt76_get_field(dev, MT_FL_Q2_CTRL, -- 2.18.0