Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace one-element arrays with flex-array members in drivers/net/wireless/marvell/mwifiex/fw.h #256

Closed
GustavoARSilva opened this issue Feb 3, 2023 · 1 comment
Assignees
Labels
[Idiom] fake flexible array [PATCH] Accepted A submitted patch has been accepted upstream [PATCH] Exists A patch exists to address the issue [Refactor] 1-element array Conversion away from one-element array

Comments

@GustavoARSilva
Copy link
Collaborator

drivers/net/wireless/marvell/mwifiex/fw.h:
struct mwifiex_fw_header {
 struct mwifiex_fw_data {
 	struct mwifiex_fw_header header;
 	__le32 seq_num;
	u8 data[1];
 } __packed;
 
 struct mwifiex_ie_types_data {
 	struct mwifiex_ie_types_header header;
	u8 data[1];
 } __packed;

 struct mwifiex_ie_types_ssid_param_set {
 	struct mwifiex_ie_types_header header;
	u8 ssid[1];
 } __packed;
 
 struct mwifiex_ie_types_rsn_param_set {
 	struct mwifiex_ie_types_header header;
	u8 rsn_ie[1];
 } __packed;
 
 struct host_cmd_ds_tdls_config {
 	__le16 tdls_action;
	u8 tdls_data[1];
 } __packed;

 struct host_cmd_ds_802_11_scan {
 	u8 bss_mode;
 	u8 bssid[ETH_ALEN];
	u8 tlv_buffer[1];
 } __packed;
 
 struct host_cmd_ds_802_11_scan_rsp {
 	__le16 bss_descript_size;
 	u8 number_of_sets;
	u8 bss_desc_and_tlv_buffer[1];
 } __packed;

 struct mwifiex_ie_types_bss_scan_rsp {
 	struct mwifiex_ie_types_header header;
 	u8 bssid[ETH_ALEN];
	u8 frame_body[1];
 } __packed;
 
 struct mwifiex_ie_types_wmm_param_set {
 	struct mwifiex_ie_types_header header;
	u8 wmm_ie[1];
 } __packed;
 
struct host_cmd_tlv_wep_key {
 	struct mwifiex_ie_types_header header;
 	u8 key_index;
 	u8 is_default;
	u8 key[1];
 };
@GustavoARSilva GustavoARSilva self-assigned this Feb 3, 2023
@GustavoARSilva GustavoARSilva added the [PATCH] Exists A patch exists to address the issue label Feb 3, 2023
ammarfaizi2 pushed a commit to ammarfaizi2/linux-block that referenced this issue Feb 13, 2023
One-element arrays are deprecated, and we are replacing them with flexible
array members instead. So, replace one-element arrays with flexible-array
members in multiple structures.

This helps with the ongoing efforts to tighten the FORTIFY_SOURCE
routines on memcpy() and help us make progress towards globally
enabling -fstrict-flex-arrays=3 [1].

This results in no differences in binary output.

Link: KSPP/linux#79
Link: KSPP/linux#256
Link: https://gcc.gnu.org/pipermail/gcc-patches/2022-October/602902.html [1]
Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Reviewed-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/Y9xkECG3uTZ6T1dN@work
@GustavoARSilva GustavoARSilva added the [PATCH] Accepted A submitted patch has been accepted upstream label May 2, 2023
@GustavoARSilva
Copy link
Collaborator Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Idiom] fake flexible array [PATCH] Accepted A submitted patch has been accepted upstream [PATCH] Exists A patch exists to address the issue [Refactor] 1-element array Conversion away from one-element array
Projects
None yet
Development

No branches or pull requests

1 participant