Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp413144rwb; Tue, 6 Dec 2022 23:36:27 -0800 (PST) X-Google-Smtp-Source: AA0mqf7y8y48LHNmkN426z5M74r/MSbTNm7bRlXPhzgkaMk+2feMPoxKOgxDj8UxrRc4w5uuVoFO X-Received: by 2002:a17:907:8d1a:b0:7ae:6ffe:a118 with SMTP id tc26-20020a1709078d1a00b007ae6ffea118mr75195669ejc.250.1670398587077; 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=yCaAaSBQqhE0DF4DpYJ8wsTF+6wjREvdsN1uw6Q0EcftjVuHsRzqmHl+8DGGdLMNCI pGDVhlCZiBz+DJH47kOj4lUeYg3eDzMfOx39w8ZtoJlUpsbllHBJGlzQaWIAViCJCuew vmoW9NcST7iMOFfaejRYYum0TxJdmcKudJ99fLteExQwhtS4tXACknw8I5yjp/HdjFj0 Qb01NcoExMtoei+k5UtrJdM1SlvaDIhP+C7cztLqImR0IvqcdPaFsrSh3dYs2GVmPwn4 VtsCFcC9GocCIMTg1dLBUUjLc3Ku+vErDJXC1ZtEeMsfE5B19BVx7CuCQr8USNr5U+HD CfUg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=56GrzRTzL4IqyjNFK17cSt2aS1qNNZ9O5Pqe/qVyOYk=; b=EUz7yQwOcHb/H/vCe9ynjn5FfVdHPyCvWW3hicWHklurQ6SjGfKyMmKa/AinfmCxZ2 PIl/cxkhzBI/4kc5cAQqnQYURMrWVM4Vj4SaxWRupvBKzDOEDAuaSVoUIaJr4ABBiMeK AzKMCrz2vbjVE4GifRggIP66nflMVkEU87q4Revb5evBqODO62VwPBcrOuDfdbe7K9nL gcR1DPcRCMXChrQ0t8FRsilhNwuDNLsdNzSJJYPMe7GrlbDModvLWmux23d/tUNioAgf Psu35NnZiLZlb6h/+nktzUsVnFIcRRinheSbzv4nblNwu/9qQ4n+Po/ue1YY2RauVpWQ cwJA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=sEaqE0nY; 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 dn16-20020a17090794d000b007824b85978asi16772310ejc.81.2022.12.06.23.36.08; 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=sEaqE0nY; 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 S229605AbiLGHaX (ORCPT + 66 others); Wed, 7 Dec 2022 02:30:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56972 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229480AbiLGHaU (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 417A527B23 for ; Tue, 6 Dec 2022 23:30:15 -0800 (PST) X-UUID: a0630682178d4ba393bdd264a6efd17b-20221207 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=56GrzRTzL4IqyjNFK17cSt2aS1qNNZ9O5Pqe/qVyOYk=; b=sEaqE0nY8mpKGEcU4V6AB+VH0R8z9MdUDLRuv4OEiNlSllQS12zJ4Yzx5DR1dxuXdOEpO3ARHfeTJ23V0/ASSoTKZTKSqQmlX6nMlAvUnLc6eLfJX9O42y3aGrDY7pEfcp04Bs2rti6EsEpCL46xBajrvVbM2lQgyN92OGe+h/g=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.14,REQID:c3103057-fc57-4552-a48a-72a2bc8863be,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:ba3ce3d1-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: a0630682178d4ba393bdd264a6efd17b-20221207 Received: from mtkmbs11n1.mediatek.inc [(172.21.101.185)] by mailgw01.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 738552252; Wed, 07 Dec 2022 15:30:10 +0800 Received: from mtkmbs13n2.mediatek.inc (172.21.101.108) by mtkmbs13n1.mediatek.inc (172.21.101.193) 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:09 +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:09 +0800 From: Ryder Lee To: Felix Fietkau , CC: Lorenzo Bianconi , Shayne Chen , Evelyn Tsai , , Ryder Lee Subject: [PATCH 2/2] wifi: mt76: mt7915: fix unintended sign extension of mt7915_hw_queue_read() Date: Wed, 7 Dec 2022 15:30:05 +0800 Message-ID: <1c3c811a6f0a3ad54499729c1020e0504fea6c7d.1670396836.git.ryder.lee@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain X-MTK: N X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS,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. Fixes: 776ec4e77aa6 ("mt76: mt7915: rework debugfs queue info") Signed-off-by: Ryder Lee --- drivers/net/wireless/mediatek/mt76/mt7915/debugfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/debugfs.c b/drivers/net/wireless/mediatek/mt76/mt7915/debugfs.c index a7fdcd1f3d98..5a46813a59ea 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7915/debugfs.c +++ b/drivers/net/wireless/mediatek/mt76/mt7915/debugfs.c @@ -811,7 +811,7 @@ mt7915_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