Re: [PATCH] staging: rtl8192e, rtl8192u: use correct notation to define pointer
From: Muhammad Usama Anjum
Date: Thu Feb 04 2021 - 14:32:23 EST
> Sparse's warning is not about changing the definition of this member
> as if it was the argument of a function. It's about how can you use
> an array of structure when this structure has a flexible member.
We have the following structures in drivers/staging/rtl8192e. (I've
simplified them for showing here.)
struct rtllib_hdr_3addr {
int a;
int payload[];
};
struct rtllib_info_element {
int len;
int data[];
};
struct rtllib_probe_request {
struct rtllib_hdr_3addr header;
struct rtllib_info_element info_element[];
};
static void func(struct rtllib_probe_request *ptr) {
ptr->header.a = 1;
}
Running sparse gives:
sparse -Wflexible-array-array flexible_array.c
flexible_array.c:13:48: warning: array of flexible structures
There are several such structures in rtl8192e and rtl8192u. I've been
trying to fix one of them. But it seems like more knowledge is
required to refactor the driver.
Thanks,
Usama