From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F1270BA45 for ; Tue, 7 Mar 2023 18:05:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0CB87C433EF; Tue, 7 Mar 2023 18:05:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1678212312; bh=2A80Z58Hp2NSVCCFodeok3KSXLHNndCp9od2ZunT07U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kb0m9+QVsugnzcMVjoadcACIIHvrZuKp8wzjhvOnbsOCa8v8/pmUJWSivUSNgwFMv YsAZmaL4k7S42GtcngBLS3t/zaIBvpKpwiUTXtbNFFLeGiSFsZgKGbv5Ic6spA23tZ no5CyA6ATnryjN/QKcheYtbY+kffm5q9MjQgbmCg= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Ryder Lee , Felix Fietkau , Sasha Levin Subject: [PATCH 6.1 115/885] wifi: mt76: mt7915: fix unintended sign extension of mt7915_hw_queue_read() Date: Tue, 7 Mar 2023 17:50:49 +0100 Message-Id: <20230307170006.878516966@linuxfoundation.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230307170001.594919529@linuxfoundation.org> References: <20230307170001.594919529@linuxfoundation.org> User-Agent: quilt/0.67 Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Ryder Lee [ Upstream commit edb0406bda4629ef496f52eb11cbea7e92ed301b ] 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 Signed-off-by: Felix Fietkau Signed-off-by: Sasha Levin --- 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 6ef3431cad648..2975128a78c90 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7915/debugfs.c +++ b/drivers/net/wireless/mediatek/mt76/mt7915/debugfs.c @@ -759,7 +759,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.39.2