staging: wfx: avoid defining array of flexible struct
PATCH 1/1 staging: wfx: avoid defining array of flexible struct
In this particular case, the struct element is already flexible struct. Thus struct element ie[] is ambiguous inside another struct. The members of struct element ie aren't being accessed in code anywhere. The data of u8 type is copied in it. So it has been changed to u8 ie[] to make the sparse happy and code simple.
Warning from sparse:drivers/stagingwfx/hif_tx.c: note: in included file (through drivers/stagingwfx/data_tx.h, drivers/staging//wfx/wfx.h):
drivers/staging//wfx/hif_api_cmd.h:103:26: warning: array of flexible structures
--- drivers/staging/wfx/hif_api_cmd.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/wfx/hif_api_cmd.h +1 -1
@@ -100,7 +100,7 @@ struct hif_req_update_ie { u8 reserved1:5;u8 reserved2;__le16 num_ies; -struct element ie[]; +u8 ie[]; } __packed;struct hif_cnf_update_ie {
Signature · 1 line
2.25.1
Quoted 6 lines · On Thursday 11 February 2021 11:50:26 CET Muhammad Usama Anjum wrote:
In this particular case, the struct element is already flexible struct. Thus struct element ie[] is ambiguous inside another struct. The members of struct element ie aren't being accessed in code anywhere. The data of u8 type is copied in it. So it has been changed to u8 ie[] to make the sparse happy and code simple.
You may also mention that the driver code does not care of the type of the ie attribute. It is only accessed from one place with memcpy().
Quoted 24 lines
Warning from sparse:
drivers/stagingwfx/hif_tx.c: note: in included file (throughdrivers/stagingwfx/data_tx.h, drivers/staging//wfx/wfx.h):
drivers/staging//wfx/hif_api_cmd.h:103:26: warning: array of flexible structuresSigned-off-by Muhammad Usama Anjum <[email protected]>--- drivers/staging/wfx/hif_api_cmd.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/staging/wfx/hif_api_cmd.h +1
-2@@ -100,7 +100,7 @@ struct hif_req_update_ie { u8 reserved1:5;u8 reserved2;__le16 num_ies; -struct element ie[]; +u8 ie[]; } __packed;struct hif_cnf_update_ie { --
Quoted 3 lines
2.25.1
I think that "#include <linux/ieee80211.h>" is no more necessary.
Else:
Signature · 1 line
Jérôme Pouiller
Quoted 2 lines
I think that "#include <
linux/ieee80211.h>" is no more necessary.
Good catch. I'll send another patch.
Thanks,
Usama