From a44109267e4eaf949bee7564707ac33874d8eca7 Mon Sep 17 00:00:00 2001 From: Ryder Lee Date: Wed, 7 Dec 2022 15:30:04 +0800 Subject: [PATCH] wifi: mt76: mt7996: fix unintended sign extension of mt7996_hw_queue_read() 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 Signed-off-by: Felix Fietkau --- mt7996/debugfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mt7996/debugfs.c b/mt7996/debugfs.c index 99b23aef..3d4fbbbc 100644 --- a/mt7996/debugfs.c +++ b/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,