mt76: update to Git HEAD (2023-12-08)
[openwrt/staging/blocktrron.git] / package / kernel / mt76 / patches / 0006-wifi-mt76-mt7921-fix-incorrect-type-conversion-for-C.patch
diff --git a/package/kernel/mt76/patches/0006-wifi-mt76-mt7921-fix-incorrect-type-conversion-for-C.patch b/package/kernel/mt76/patches/0006-wifi-mt76-mt7921-fix-incorrect-type-conversion-for-C.patch
new file mode 100644 (file)
index 0000000..a85dfb7
--- /dev/null
@@ -0,0 +1,38 @@
+From d75eac9f5531e484fbbabf2652922976e15a7a7a Mon Sep 17 00:00:00 2001
+From: Ming Yen Hsieh <mingyen.hsieh@mediatek.com>
+Date: Tue, 16 Jan 2024 10:48:54 +0800
+Subject: [PATCH] wifi: mt76: mt7921: fix incorrect type conversion for CLC
+ command
+
+clc->len is defined as 32 bits in length, so it must also be
+operated on with 32 bits, not 16 bits.
+
+Fixes: fa6ad88e023d ("wifi: mt76: mt7921: fix country count limitation for CLC")
+Signed-off-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com>
+Reported-by: kernel test robot <lkp@intel.com>
+Closes: https://lore.kernel.org/oe-kbuild-all/202312112104.Zkc3QUHr-lkp@intel.com/
+Signed-off-by: Felix Fietkau <nbd@nbd.name>
+---
+ mt7921/mcu.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+--- a/mt7921/mcu.c
++++ b/mt7921/mcu.c
+@@ -1272,7 +1272,7 @@ int __mt7921_mcu_set_clc(struct mt792x_d
+               .mtcl_conf = mt792x_acpi_get_mtcl_conf(&dev->phy, alpha2),
+       };
+       int ret, valid_cnt = 0;
+-      u16 buf_len = 0;
++      u32 buf_len = 0;
+       u8 *pos;
+       if (!clc)
+@@ -1283,7 +1283,7 @@ int __mt7921_mcu_set_clc(struct mt792x_d
+       if (mt76_find_power_limits_node(&dev->mt76))
+               req.cap |= CLC_CAP_DTS_EN;
+-      buf_len = le16_to_cpu(clc->len) - sizeof(*clc);
++      buf_len = le32_to_cpu(clc->len) - sizeof(*clc);
+       pos = clc->data;
+       while (buf_len > 16) {
+               struct mt7921_clc_rule *rule = (struct mt7921_clc_rule *)pos;