Linux wireless drivers development
 help / color / mirror / Atom feed
* [PATCH v1 1/2] wifi: mt76: init chan pointer to aovid unexpected behavior
@ 2026-12-02  8:18 Anthony Liu
  2026-12-02  8:18 ` [PATCH v1 2/2] wifi: mt76: add boundary check to array accesses Anthony Liu
  0 siblings, 1 reply; 3+ messages in thread
From: Anthony Liu @ 2026-12-02  8:18 UTC (permalink / raw)
  To: anthony.liu
  Cc: Emery.Hsin, Jb.Tsai, Leon.Yen, Litien.Chang, Quan.Zhou, Ryder.Lee,
	Sean.Wang, kun.wu, linux-wireless, lorenzo, nbd

In mt76_remain_on_channel(), defensively initialize chandef.chan with
the requested channel instead of using an empty initializer.

Signed-off-by: Anthony Liu <anthony.liu@mediatek.com>
---
 drivers/net/wireless/mediatek/mt76/channel.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/mediatek/mt76/channel.c b/drivers/net/wireless/mediatek/mt76/channel.c
index b3c17f76b101..0db1e5456c30 100644
--- a/drivers/net/wireless/mediatek/mt76/channel.c
+++ b/drivers/net/wireless/mediatek/mt76/channel.c
@@ -449,7 +449,7 @@ int mt76_remain_on_channel(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
 			   struct ieee80211_channel *chan, int duration,
 			   enum ieee80211_roc_type type)
 {
-	struct cfg80211_chan_def chandef = {};
+	struct cfg80211_chan_def chandef = { .chan = chan };
 	struct mt76_phy *phy = hw->priv;
 	struct mt76_dev *dev = phy->dev;
 	struct mt76_vif_link *mlink;
-- 
2.45.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH v1 2/2] wifi: mt76: add boundary check to array accesses
  2026-12-02  8:18 [PATCH v1 1/2] wifi: mt76: init chan pointer to aovid unexpected behavior Anthony Liu
@ 2026-12-02  8:18 ` Anthony Liu
  2026-12-03  3:02   ` kernel test robot
  0 siblings, 1 reply; 3+ messages in thread
From: Anthony Liu @ 2026-12-02  8:18 UTC (permalink / raw)
  To: anthony.liu
  Cc: Emery.Hsin, Jb.Tsai, Leon.Yen, Litien.Chang, Quan.Zhou, Ryder.Lee,
	Sean.Wang, kun.wu, linux-wireless, lorenzo, nbd

Add array boundary check to functions accessing Tx qeueus, MCU
queues, and ACPI data tables.

Signed-off-by: Anthony Liu <anthony.liu@mediatek.com>
---
 drivers/net/wireless/mediatek/mt76/mt76.h            | 6 ++++++
 drivers/net/wireless/mediatek/mt76/mt792x_acpi_sar.c | 7 +++++++
 2 files changed, 13 insertions(+)

diff --git a/drivers/net/wireless/mediatek/mt76/mt76.h b/drivers/net/wireless/mediatek/mt76/mt76.h
index 237057caf35e..f9c38a8c0722 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76.h
+++ b/drivers/net/wireless/mediatek/mt76/mt76.h
@@ -1397,6 +1397,9 @@ static inline int mt76_init_tx_queue(struct mt76_phy *phy, int qid, int idx,
 {
 	struct mt76_queue *q;
 
+	if (qid < 0 || qid >= ARRAY_SIZE(dev->q_tx))
+		return -EINVAL;
+
 	q = mt76_init_queue(phy->dev, qid, idx, n_desc, ring_base, wed, flags);
 	if (IS_ERR(q))
 		return PTR_ERR(q);
@@ -1411,6 +1414,9 @@ static inline int mt76_init_mcu_queue(struct mt76_dev *dev, int qid, int idx,
 {
 	struct mt76_queue *q;
 
+	if (qid < 0 || qid >= ARRAY_SIZE(dev->q_mcu))
+		return -EINVAL;
+
 	q = mt76_init_queue(dev, qid, idx, n_desc, ring_base, NULL, 0);
 	if (IS_ERR(q))
 		return PTR_ERR(q);
diff --git a/drivers/net/wireless/mediatek/mt76/mt792x_acpi_sar.c b/drivers/net/wireless/mediatek/mt76/mt792x_acpi_sar.c
index d8268ec56f98..459d5c86c095 100644
--- a/drivers/net/wireless/mediatek/mt76/mt792x_acpi_sar.c
+++ b/drivers/net/wireless/mediatek/mt76/mt792x_acpi_sar.c
@@ -432,6 +432,9 @@ mt792x_acpi_get_mtcl_map_v3(int row, int column, struct mt792x_asar_cl_v3 *cl)
 	u32 config = 0;
 	u8 mode_be = 0;
 
+	if (row < 0 || row >= ARRAY_SIZE(cl->clbe))
+		return 0;
+
 	mode_be = (cl->mode_be > 0x02) ? 0 : cl->mode_be;
 
 	if (cl->version > 2 && cl->clbe[row] & BIT(column))
@@ -446,6 +449,10 @@ mt792x_acpi_get_mtcl_map(int row, int column, struct mt792x_asar_cl *cl)
 	u32 config = 0;
 	u8 mode_6g, mode_5g9;
 
+	if (row < 0 || row >= ARRAY_SIZE(cl->cl6g) ||
+	    row >= ARRAY_SIZE(cl->cl5g9))
+		return 0;
+
 	mode_6g = (cl->mode_6g > 0x02) ? 0 : cl->mode_6g;
 	mode_5g9 = (cl->mode_5g9 > 0x01) ? 0 : cl->mode_5g9;
 
-- 
2.45.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v1 2/2] wifi: mt76: add boundary check to array accesses
  2026-12-02  8:18 ` [PATCH v1 2/2] wifi: mt76: add boundary check to array accesses Anthony Liu
@ 2026-12-03  3:02   ` kernel test robot
  0 siblings, 0 replies; 3+ messages in thread
From: kernel test robot @ 2026-12-03  3:02 UTC (permalink / raw)
  To: Anthony Liu
  Cc: oe-kbuild-all, Emery.Hsin, Jb.Tsai, Leon.Yen, Litien.Chang,
	Quan.Zhou, Ryder.Lee, Sean.Wang, kun.wu, linux-wireless, lorenzo,
	nbd

Hi Anthony,

kernel test robot noticed the following build errors:

[auto build test ERROR on wireless-next/main]
[also build test ERROR on wireless/main linus/master v7.4-rc5 next-20261202]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Anthony-Liu/wifi-mt76-add-boundary-check-to-array-accesses/20261202-161806
base:   https://git.kernel.org/pub/scm/linux/kernel/git/wireless/wireless-next.git main
patch link:    https://lore.kernel.org/r/20261202081806.1297416-2-anthony.liu%40mediatek.com
patch subject: [PATCH v1 2/2] wifi: mt76: add boundary check to array accesses
config: x86_64-rhel-9.4 (https://download.01.org/0day-ci/archive/20261203/20261203105244.RBdWyoat-lkp@intel.com/config)
compiler: gcc-14 (Debian 14.2.0-19) 14.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20261203/20261203105244.RBdWyoat-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/20261203105244.RBdWyoat-lkp@intel.com/

All errors (new ones prefixed by >>):

   In file included from include/linux/kernel.h:16,
                    from drivers/net/wireless/mediatek/mt76/mt76.h:9,
                    from drivers/net/wireless/mediatek/mt76/mmio.c:6:
   drivers/net/wireless/mediatek/mt76/mt76.h: In function 'mt76_init_tx_queue':
>> drivers/net/wireless/mediatek/mt76/mt76.h:1364:42: error: 'dev' undeclared (first use in this function); did you mean 'cdev'?
    1364 |         if (qid < 0 || qid >= ARRAY_SIZE(dev->q_tx))
         |                                          ^~~
   include/linux/array_size.h:11:33: note: in definition of macro 'ARRAY_SIZE'
      11 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
         |                                 ^~~
   drivers/net/wireless/mediatek/mt76/mt76.h:1364:42: note: each undeclared identifier is reported only once for each function it appears in
    1364 |         if (qid < 0 || qid >= ARRAY_SIZE(dev->q_tx))
         |                                          ^~~
   include/linux/array_size.h:11:33: note: in definition of macro 'ARRAY_SIZE'
      11 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
         |                                 ^~~
   In file included from include/linux/array_size.h:5:
>> include/linux/compiler.h:200:82: error: expression in static assertion is not an integer
     200 | #define __BUILD_BUG_ON_ZERO_MSG(e, msg, ...) ((int)sizeof(struct {_Static_assert(!(e), msg);}))
         |                                                                                  ^
   include/linux/compiler.h:205:33: note: in expansion of macro '__BUILD_BUG_ON_ZERO_MSG'
     205 | #define __must_be_array(a)      __BUILD_BUG_ON_ZERO_MSG(!__is_array(a), \
         |                                 ^~~~~~~~~~~~~~~~~~~~~~~
   include/linux/array_size.h:11:59: note: in expansion of macro '__must_be_array'
      11 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
         |                                                           ^~~~~~~~~~~~~~~
   drivers/net/wireless/mediatek/mt76/mt76.h:1364:31: note: in expansion of macro 'ARRAY_SIZE'
    1364 |         if (qid < 0 || qid >= ARRAY_SIZE(dev->q_tx))
         |                               ^~~~~~~~~~
--
   In file included from include/linux/kernel.h:16,
                    from drivers/net/wireless/mediatek/mt76/mt76x0/usb.c:6:
   drivers/net/wireless/mediatek/mt76/mt76x0/../mt76.h: In function 'mt76_init_tx_queue':
>> drivers/net/wireless/mediatek/mt76/mt76x0/../mt76.h:1364:42: error: 'dev' undeclared (first use in this function); did you mean 'cdev'?
    1364 |         if (qid < 0 || qid >= ARRAY_SIZE(dev->q_tx))
         |                                          ^~~
   include/linux/array_size.h:11:33: note: in definition of macro 'ARRAY_SIZE'
      11 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
         |                                 ^~~
   drivers/net/wireless/mediatek/mt76/mt76x0/../mt76.h:1364:42: note: each undeclared identifier is reported only once for each function it appears in
    1364 |         if (qid < 0 || qid >= ARRAY_SIZE(dev->q_tx))
         |                                          ^~~
   include/linux/array_size.h:11:33: note: in definition of macro 'ARRAY_SIZE'
      11 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
         |                                 ^~~
   In file included from include/linux/array_size.h:5:
>> include/linux/compiler.h:200:82: error: expression in static assertion is not an integer
     200 | #define __BUILD_BUG_ON_ZERO_MSG(e, msg, ...) ((int)sizeof(struct {_Static_assert(!(e), msg);}))
         |                                                                                  ^
   include/linux/compiler.h:205:33: note: in expansion of macro '__BUILD_BUG_ON_ZERO_MSG'
     205 | #define __must_be_array(a)      __BUILD_BUG_ON_ZERO_MSG(!__is_array(a), \
         |                                 ^~~~~~~~~~~~~~~~~~~~~~~
   include/linux/array_size.h:11:59: note: in expansion of macro '__must_be_array'
      11 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
         |                                                           ^~~~~~~~~~~~~~~
   drivers/net/wireless/mediatek/mt76/mt76x0/../mt76.h:1364:31: note: in expansion of macro 'ARRAY_SIZE'
    1364 |         if (qid < 0 || qid >= ARRAY_SIZE(dev->q_tx))
         |                               ^~~~~~~~~~
--
   In file included from include/linux/string.h:6,
                    from include/linux/bitmap.h:13,
                    from include/linux/cpumask.h:11,
                    from arch/x86/include/asm/paravirt.h:19,
                    from arch/x86/include/asm/irqflags.h:100,
                    from include/linux/irqflags.h:18,
                    from arch/x86/include/asm/special_insns.h:10,
                    from arch/x86/include/asm/processor.h:25,
                    from arch/x86/include/asm/timex.h:5,
                    from include/linux/timex.h:67,
                    from include/linux/time32.h:13,
                    from include/linux/time.h:60,
                    from include/linux/stat.h:19,
                    from include/linux/module.h:13,
                    from drivers/net/wireless/mediatek/mt76/mt76x2/eeprom.c:6:
   drivers/net/wireless/mediatek/mt76/mt76x2/../mt76.h: In function 'mt76_init_tx_queue':
>> drivers/net/wireless/mediatek/mt76/mt76x2/../mt76.h:1364:42: error: 'dev' undeclared (first use in this function); did you mean 'cdev'?
    1364 |         if (qid < 0 || qid >= ARRAY_SIZE(dev->q_tx))
         |                                          ^~~
   include/linux/array_size.h:11:33: note: in definition of macro 'ARRAY_SIZE'
      11 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
         |                                 ^~~
   drivers/net/wireless/mediatek/mt76/mt76x2/../mt76.h:1364:42: note: each undeclared identifier is reported only once for each function it appears in
    1364 |         if (qid < 0 || qid >= ARRAY_SIZE(dev->q_tx))
         |                                          ^~~
   include/linux/array_size.h:11:33: note: in definition of macro 'ARRAY_SIZE'
      11 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
         |                                 ^~~
   In file included from include/linux/build_bug.h:5,
                    from include/linux/container_of.h:5,
                    from include/linux/list.h:5,
                    from include/linux/module.h:12:
>> include/linux/compiler.h:200:82: error: expression in static assertion is not an integer
     200 | #define __BUILD_BUG_ON_ZERO_MSG(e, msg, ...) ((int)sizeof(struct {_Static_assert(!(e), msg);}))
         |                                                                                  ^
   include/linux/compiler.h:205:33: note: in expansion of macro '__BUILD_BUG_ON_ZERO_MSG'
     205 | #define __must_be_array(a)      __BUILD_BUG_ON_ZERO_MSG(!__is_array(a), \
         |                                 ^~~~~~~~~~~~~~~~~~~~~~~
   include/linux/array_size.h:11:59: note: in expansion of macro '__must_be_array'
      11 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
         |                                                           ^~~~~~~~~~~~~~~
   drivers/net/wireless/mediatek/mt76/mt76x2/../mt76.h:1364:31: note: in expansion of macro 'ARRAY_SIZE'
    1364 |         if (qid < 0 || qid >= ARRAY_SIZE(dev->q_tx))
         |                               ^~~~~~~~~~
--
   In file included from include/linux/string.h:6,
                    from include/linux/bitmap.h:13,
                    from include/linux/cpumask.h:11,
                    from arch/x86/include/asm/paravirt.h:19,
                    from arch/x86/include/asm/irqflags.h:100,
                    from include/linux/irqflags.h:18,
                    from arch/x86/include/asm/special_insns.h:10,
                    from arch/x86/include/asm/processor.h:25,
                    from include/linux/sched.h:13,
                    from include/linux/ratelimit.h:6,
                    from include/linux/dev_printk.h:16,
                    from include/linux/device.h:15,
                    from include/linux/devcoredump.h:8,
                    from drivers/net/wireless/mediatek/mt76/mt7921/mac.c:4:
   drivers/net/wireless/mediatek/mt76/mt7921/../mt76.h: In function 'mt76_init_tx_queue':
>> drivers/net/wireless/mediatek/mt76/mt7921/../mt76.h:1364:42: error: 'dev' undeclared (first use in this function); did you mean 'cdev'?
    1364 |         if (qid < 0 || qid >= ARRAY_SIZE(dev->q_tx))
         |                                          ^~~
   include/linux/array_size.h:11:33: note: in definition of macro 'ARRAY_SIZE'
      11 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
         |                                 ^~~
   drivers/net/wireless/mediatek/mt76/mt7921/../mt76.h:1364:42: note: each undeclared identifier is reported only once for each function it appears in
    1364 |         if (qid < 0 || qid >= ARRAY_SIZE(dev->q_tx))
         |                                          ^~~
   include/linux/array_size.h:11:33: note: in definition of macro 'ARRAY_SIZE'
      11 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
         |                                 ^~~
   In file included from include/linux/dev_printk.h:14:
>> include/linux/compiler.h:200:82: error: expression in static assertion is not an integer
     200 | #define __BUILD_BUG_ON_ZERO_MSG(e, msg, ...) ((int)sizeof(struct {_Static_assert(!(e), msg);}))
         |                                                                                  ^
   include/linux/compiler.h:205:33: note: in expansion of macro '__BUILD_BUG_ON_ZERO_MSG'
     205 | #define __must_be_array(a)      __BUILD_BUG_ON_ZERO_MSG(!__is_array(a), \
         |                                 ^~~~~~~~~~~~~~~~~~~~~~~
   include/linux/array_size.h:11:59: note: in expansion of macro '__must_be_array'
      11 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
         |                                                           ^~~~~~~~~~~~~~~
   drivers/net/wireless/mediatek/mt76/mt7921/../mt76.h:1364:31: note: in expansion of macro 'ARRAY_SIZE'
    1364 |         if (qid < 0 || qid >= ARRAY_SIZE(dev->q_tx))
         |                               ^~~~~~~~~~
--
   In file included from include/linux/string.h:6,
                    from include/linux/bitmap.h:13,
                    from include/linux/cpumask.h:11,
                    from arch/x86/include/asm/paravirt.h:19,
                    from arch/x86/include/asm/irqflags.h:100,
                    from include/linux/irqflags.h:18,
                    from arch/x86/include/asm/special_insns.h:10,
                    from arch/x86/include/asm/processor.h:25,
                    from include/linux/sched.h:13,
                    from include/linux/ratelimit.h:6,
                    from include/linux/dev_printk.h:16,
                    from include/linux/device.h:15,
                    from include/linux/devcoredump.h:8,
                    from drivers/net/wireless/mediatek/mt76/mt7925/mac.c:4:
   drivers/net/wireless/mediatek/mt76/mt7925/../mt76.h: In function 'mt76_init_tx_queue':
>> drivers/net/wireless/mediatek/mt76/mt7925/../mt76.h:1364:42: error: 'dev' undeclared (first use in this function); did you mean 'cdev'?
    1364 |         if (qid < 0 || qid >= ARRAY_SIZE(dev->q_tx))
         |                                          ^~~
   include/linux/array_size.h:11:33: note: in definition of macro 'ARRAY_SIZE'
      11 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
         |                                 ^~~
   drivers/net/wireless/mediatek/mt76/mt7925/../mt76.h:1364:42: note: each undeclared identifier is reported only once for each function it appears in
    1364 |         if (qid < 0 || qid >= ARRAY_SIZE(dev->q_tx))
         |                                          ^~~
   include/linux/array_size.h:11:33: note: in definition of macro 'ARRAY_SIZE'
      11 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
         |                                 ^~~
   In file included from include/linux/dev_printk.h:14:
>> include/linux/compiler.h:200:82: error: expression in static assertion is not an integer
     200 | #define __BUILD_BUG_ON_ZERO_MSG(e, msg, ...) ((int)sizeof(struct {_Static_assert(!(e), msg);}))
         |                                                                                  ^
   include/linux/compiler.h:205:33: note: in expansion of macro '__BUILD_BUG_ON_ZERO_MSG'
     205 | #define __must_be_array(a)      __BUILD_BUG_ON_ZERO_MSG(!__is_array(a), \
         |                                 ^~~~~~~~~~~~~~~~~~~~~~~
   include/linux/array_size.h:11:59: note: in expansion of macro '__must_be_array'
      11 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
         |                                                           ^~~~~~~~~~~~~~~
   drivers/net/wireless/mediatek/mt76/mt7925/../mt76.h:1364:31: note: in expansion of macro 'ARRAY_SIZE'
    1364 |         if (qid < 0 || qid >= ARRAY_SIZE(dev->q_tx))
         |                               ^~~~~~~~~~
--
   In file included from include/linux/kernel.h:16,
                    from wireless/mediatek/mt76/mt76.h:9,
                    from wireless/mediatek/mt76/mmio.c:6:
   wireless/mediatek/mt76/mt76.h: In function 'mt76_init_tx_queue':
   wireless/mediatek/mt76/mt76.h:1364:42: error: 'dev' undeclared (first use in this function); did you mean 'cdev'?
    1364 |         if (qid < 0 || qid >= ARRAY_SIZE(dev->q_tx))
         |                                          ^~~
   include/linux/array_size.h:11:33: note: in definition of macro 'ARRAY_SIZE'
      11 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
         |                                 ^~~
   wireless/mediatek/mt76/mt76.h:1364:42: note: each undeclared identifier is reported only once for each function it appears in
    1364 |         if (qid < 0 || qid >= ARRAY_SIZE(dev->q_tx))
         |                                          ^~~
   include/linux/array_size.h:11:33: note: in definition of macro 'ARRAY_SIZE'
      11 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
         |                                 ^~~
   In file included from include/linux/array_size.h:5:
>> include/linux/compiler.h:200:82: error: expression in static assertion is not an integer
     200 | #define __BUILD_BUG_ON_ZERO_MSG(e, msg, ...) ((int)sizeof(struct {_Static_assert(!(e), msg);}))
         |                                                                                  ^
   include/linux/compiler.h:205:33: note: in expansion of macro '__BUILD_BUG_ON_ZERO_MSG'
     205 | #define __must_be_array(a)      __BUILD_BUG_ON_ZERO_MSG(!__is_array(a), \
         |                                 ^~~~~~~~~~~~~~~~~~~~~~~
   include/linux/array_size.h:11:59: note: in expansion of macro '__must_be_array'
      11 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
         |                                                           ^~~~~~~~~~~~~~~
   wireless/mediatek/mt76/mt76.h:1364:31: note: in expansion of macro 'ARRAY_SIZE'
    1364 |         if (qid < 0 || qid >= ARRAY_SIZE(dev->q_tx))
         |                               ^~~~~~~~~~
--
   In file included from include/linux/kernel.h:16,
                    from wireless/mediatek/mt76/mt76x0/usb.c:6:
   wireless/mediatek/mt76/mt76x0/../mt76.h: In function 'mt76_init_tx_queue':
   wireless/mediatek/mt76/mt76x0/../mt76.h:1364:42: error: 'dev' undeclared (first use in this function); did you mean 'cdev'?
    1364 |         if (qid < 0 || qid >= ARRAY_SIZE(dev->q_tx))
         |                                          ^~~
   include/linux/array_size.h:11:33: note: in definition of macro 'ARRAY_SIZE'
      11 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
         |                                 ^~~
   wireless/mediatek/mt76/mt76x0/../mt76.h:1364:42: note: each undeclared identifier is reported only once for each function it appears in
    1364 |         if (qid < 0 || qid >= ARRAY_SIZE(dev->q_tx))
         |                                          ^~~
   include/linux/array_size.h:11:33: note: in definition of macro 'ARRAY_SIZE'
      11 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
         |                                 ^~~
   In file included from include/linux/array_size.h:5:
>> include/linux/compiler.h:200:82: error: expression in static assertion is not an integer
     200 | #define __BUILD_BUG_ON_ZERO_MSG(e, msg, ...) ((int)sizeof(struct {_Static_assert(!(e), msg);}))
         |                                                                                  ^
   include/linux/compiler.h:205:33: note: in expansion of macro '__BUILD_BUG_ON_ZERO_MSG'
     205 | #define __must_be_array(a)      __BUILD_BUG_ON_ZERO_MSG(!__is_array(a), \
         |                                 ^~~~~~~~~~~~~~~~~~~~~~~
   include/linux/array_size.h:11:59: note: in expansion of macro '__must_be_array'
      11 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
         |                                                           ^~~~~~~~~~~~~~~
   wireless/mediatek/mt76/mt76x0/../mt76.h:1364:31: note: in expansion of macro 'ARRAY_SIZE'
    1364 |         if (qid < 0 || qid >= ARRAY_SIZE(dev->q_tx))
         |                               ^~~~~~~~~~
--
   In file included from include/linux/string.h:6,
                    from include/linux/bitmap.h:13,
                    from include/linux/cpumask.h:11,
                    from arch/x86/include/asm/paravirt.h:19,
                    from arch/x86/include/asm/irqflags.h:100,
                    from include/linux/irqflags.h:18,
                    from arch/x86/include/asm/special_insns.h:10,
                    from arch/x86/include/asm/processor.h:25,
                    from arch/x86/include/asm/timex.h:5,
                    from include/linux/timex.h:67,
                    from include/linux/time32.h:13,
                    from include/linux/time.h:60,
                    from include/linux/stat.h:19,
                    from include/linux/module.h:13,
                    from wireless/mediatek/mt76/mt76x2/eeprom.c:6:
   wireless/mediatek/mt76/mt76x2/../mt76.h: In function 'mt76_init_tx_queue':
   wireless/mediatek/mt76/mt76x2/../mt76.h:1364:42: error: 'dev' undeclared (first use in this function); did you mean 'cdev'?
    1364 |         if (qid < 0 || qid >= ARRAY_SIZE(dev->q_tx))
         |                                          ^~~
   include/linux/array_size.h:11:33: note: in definition of macro 'ARRAY_SIZE'
      11 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
         |                                 ^~~
   wireless/mediatek/mt76/mt76x2/../mt76.h:1364:42: note: each undeclared identifier is reported only once for each function it appears in
    1364 |         if (qid < 0 || qid >= ARRAY_SIZE(dev->q_tx))
         |                                          ^~~
   include/linux/array_size.h:11:33: note: in definition of macro 'ARRAY_SIZE'
      11 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
         |                                 ^~~
   In file included from include/linux/build_bug.h:5,
                    from include/linux/container_of.h:5,
                    from include/linux/list.h:5,
                    from include/linux/module.h:12:
>> include/linux/compiler.h:200:82: error: expression in static assertion is not an integer
     200 | #define __BUILD_BUG_ON_ZERO_MSG(e, msg, ...) ((int)sizeof(struct {_Static_assert(!(e), msg);}))
         |                                                                                  ^
   include/linux/compiler.h:205:33: note: in expansion of macro '__BUILD_BUG_ON_ZERO_MSG'
     205 | #define __must_be_array(a)      __BUILD_BUG_ON_ZERO_MSG(!__is_array(a), \
         |                                 ^~~~~~~~~~~~~~~~~~~~~~~
   include/linux/array_size.h:11:59: note: in expansion of macro '__must_be_array'
      11 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
         |                                                           ^~~~~~~~~~~~~~~
   wireless/mediatek/mt76/mt76x2/../mt76.h:1364:31: note: in expansion of macro 'ARRAY_SIZE'
    1364 |         if (qid < 0 || qid >= ARRAY_SIZE(dev->q_tx))
         |                               ^~~~~~~~~~
--
   In file included from include/linux/string.h:6,
                    from include/linux/bitmap.h:13,
                    from include/linux/cpumask.h:11,
                    from arch/x86/include/asm/paravirt.h:19,
                    from arch/x86/include/asm/irqflags.h:100,
                    from include/linux/irqflags.h:18,
                    from arch/x86/include/asm/special_insns.h:10,
                    from arch/x86/include/asm/processor.h:25,
                    from include/linux/sched.h:13,
                    from include/linux/ratelimit.h:6,
                    from include/linux/dev_printk.h:16,
                    from include/linux/device.h:15,
                    from include/linux/devcoredump.h:8,
                    from wireless/mediatek/mt76/mt7921/mac.c:4:
   wireless/mediatek/mt76/mt7921/../mt76.h: In function 'mt76_init_tx_queue':
   wireless/mediatek/mt76/mt7921/../mt76.h:1364:42: error: 'dev' undeclared (first use in this function); did you mean 'cdev'?
    1364 |         if (qid < 0 || qid >= ARRAY_SIZE(dev->q_tx))
         |                                          ^~~
   include/linux/array_size.h:11:33: note: in definition of macro 'ARRAY_SIZE'
      11 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
         |                                 ^~~
   wireless/mediatek/mt76/mt7921/../mt76.h:1364:42: note: each undeclared identifier is reported only once for each function it appears in
    1364 |         if (qid < 0 || qid >= ARRAY_SIZE(dev->q_tx))
         |                                          ^~~
   include/linux/array_size.h:11:33: note: in definition of macro 'ARRAY_SIZE'
      11 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
         |                                 ^~~
   In file included from include/linux/dev_printk.h:14:
>> include/linux/compiler.h:200:82: error: expression in static assertion is not an integer
     200 | #define __BUILD_BUG_ON_ZERO_MSG(e, msg, ...) ((int)sizeof(struct {_Static_assert(!(e), msg);}))
         |                                                                                  ^
   include/linux/compiler.h:205:33: note: in expansion of macro '__BUILD_BUG_ON_ZERO_MSG'
     205 | #define __must_be_array(a)      __BUILD_BUG_ON_ZERO_MSG(!__is_array(a), \
         |                                 ^~~~~~~~~~~~~~~~~~~~~~~
   include/linux/array_size.h:11:59: note: in expansion of macro '__must_be_array'
      11 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
         |                                                           ^~~~~~~~~~~~~~~
   wireless/mediatek/mt76/mt7921/../mt76.h:1364:31: note: in expansion of macro 'ARRAY_SIZE'
    1364 |         if (qid < 0 || qid >= ARRAY_SIZE(dev->q_tx))
         |                               ^~~~~~~~~~
..


vim +1364 drivers/net/wireless/mediatek/mt76/mt76.h

  1344	
  1345	int mt76_queues_read(struct seq_file *s, void *data);
  1346	void mt76_seq_puts_array(struct seq_file *file, const char *str,
  1347				 s8 *val, int len);
  1348	
  1349	int mt76_eeprom_init(struct mt76_dev *dev, int len);
  1350	int mt76_eeprom_override(struct mt76_phy *phy);
  1351	int mt76_get_of_data_from_mtd(struct mt76_dev *dev, void *eep, int offset, int len);
  1352	int mt76_get_of_data_from_nvmem(struct mt76_dev *dev, void *eep,
  1353					const char *cell_name, int len);
  1354	
  1355	struct mt76_queue *
  1356	mt76_init_queue(struct mt76_dev *dev, int qid, int idx, int n_desc,
  1357			int ring_base, void *wed, u32 flags);
  1358	static inline int mt76_init_tx_queue(struct mt76_phy *phy, int qid, int idx,
  1359					     int n_desc, int ring_base, void *wed,
  1360					     u32 flags)
  1361	{
  1362		struct mt76_queue *q;
  1363	
> 1364		if (qid < 0 || qid >= ARRAY_SIZE(dev->q_tx))
  1365			return -EINVAL;
  1366	
  1367		q = mt76_init_queue(phy->dev, qid, idx, n_desc, ring_base, wed, flags);
  1368		if (IS_ERR(q))
  1369			return PTR_ERR(q);
  1370	
  1371		phy->q_tx[qid] = q;
  1372	
  1373		return 0;
  1374	}
  1375	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-12-03  3:03 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-02  8:18 [PATCH v1 1/2] wifi: mt76: init chan pointer to aovid unexpected behavior Anthony Liu
2026-12-02  8:18 ` [PATCH v1 2/2] wifi: mt76: add boundary check to array accesses Anthony Liu
2026-12-03  3:02   ` kernel test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox