RE: [PATCH][next] wifi: rtl8xxxu: Avoid -Wflex-array-member-not-at-end warnings

Ping-Ke Shih
2025-11-26T03:26:59Z

Hi Bitterblue,

Bitterblue Smith <rtl8821cerfe2@gmail.com> wrote:
> On 21/11/2025 13:11, Zenm Chen wrote:
> > Gustavo A. R. Silva <gustavo@embeddedor.com> 於 2025年11月21日 週五 下午6:20寫道：
> >>
> >> Hi,
> >>
> >> On 11/21/25 19:06, Zenm Chen wrote:
> >>> Dear maintainers,
> >>>
> >>> With this patch applied, my system always freezes right after the rtl8xxxu
> >>> driver is loaded. is it normal?
> >>
> >> I don't think so... It probably means that struct urb urb; cannot really be
> >> moved to the end of struct rtl8xxxu_rx_urb or struct rtl8xxxu_tx_urb?
> >>
> >> It'd be great if you could share a log.
> >>
> >
> > Hi,
> >
> > Nothing helpful found from the kernel log. Maybe Realtek drivers maintainer
> > Ping-Ke could take a look what is wrong next Monday.
> >
> [...]
>
> I got something. In my case everything seemed fine until I unplugged the
> wifi adapter. And then the system still worked for a few minutes before
> it froze.
>

Zenm and I tested below changes which can also reproduce the symptom, so
I wonder driver might assume urb is the first member of struct, but
unfortunately I can't find that. Could you also help to review if something
I missed? Thanks.

--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h
+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h
@@ -1942,15 +1942,19 @@ struct rtl8xxxu_vif {
};

struct rtl8xxxu_rx_urb {
+ u8 pad[128];
struct urb urb;
struct ieee80211_hw *hw;
struct list_head list;
};

struct rtl8xxxu_tx_urb {
+ u8 pad[128];
struct urb urb;
struct ieee80211_hw *hw;
struct list_head list;
};

struct rtl8xxxu_fileops {