Просмотр исходного кода

qcacmn: Add support for size 0 flexible length arrays

Convert size 0 variable length arrays to flexible
length arrays.

Change-Id: I679a5183a4ec0bebe51396694d2ae33afecfe80f
CRs-Fixed: 3690242
Aditya Kodukula 1 год назад
Родитель
Сommit
319d20734f

+ 3 - 3
ipa/core/inc/wlan_ipa_priv.h

@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 2013-2021 The Linux Foundation. All rights reserved.
- * Copyright (c) 2021-2023 Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) 2021-2024 Qualcomm Innovation Center, Inc. All rights reserved.
  *
  * Permission to use, copy, modify, and/or distribute this software for
  * any purpose with or without fee is hereby granted, provided that the
@@ -209,7 +209,7 @@ struct wlan_ipa_tx_hdr {
  * @reserved: Reserved not used
  */
 struct frag_header {
-	uint8_t reserved[0];
+	__QDF_DECLARE_FLEX_ARRAY(uint8_t, reserved);
 };
 #elif defined(QCA_WIFI_3_0)
 /**
@@ -241,7 +241,7 @@ struct frag_header {
  * @reserved: Reserved not used
  */
 struct ipa_header {
-	uint8_t reserved[0];
+	__QDF_DECLARE_FLEX_ARRAY(uint8_t, reserved);
 };
 #else
 /**

+ 2 - 2
qdf/inc/qdf_ptr_hash.h

@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 2019 The Linux Foundation. All rights reserved.
- * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) 2022-2024 Qualcomm Innovation Center, Inc. All rights reserved.
  *
  * Permission to use, copy, modify, and/or distribute this software for
  * any purpose with or without fee is hereby granted, provided that the
@@ -65,7 +65,7 @@ struct qdf_ptr_hash_bucket {
 struct qdf_ptr_hash {
 	int8_t bits;
 	int16_t count;
-	struct qdf_ptr_hash_bucket buckets[0];
+	struct qdf_ptr_hash_bucket buckets[];
 };
 
 /**

+ 7 - 4
qdf/inc/qdf_types.h

@@ -37,14 +37,17 @@
 /* Preprocessor definitions and constants */
 #define QDF_MAX_SGLIST 4
 
+#define __QDF_DECLARE_FLEX_ARRAY(type, name) \
+	struct { \
+		struct {} dummy_struct; \
+		type name[]; \
+	}
+
 /* Define a QDF macro for declaring flexible arrays */
 #define QDF_FLEX_ARRAY(type, name) \
 	union { \
 		type name ## _first_element; \
-		struct { \
-			struct {} dummy_struct; \
-			type name[]; \
-		}; \
+		__QDF_DECLARE_FLEX_ARRAY(type, name); \
 	}
 
 /*

+ 3 - 3
spectral/dispatcher/inc/spectral_ioctl.h

@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 2011, 2017-2021 The Linux Foundation. All rights reserved.
- * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) 2022-2024 Qualcomm Innovation Center, Inc. All rights reserved.
  *
  * Permission to use, copy, modify, and/or distribute this software for
  * any purpose with or without fee is hereby granted, provided that the
@@ -562,7 +562,7 @@ struct samp_detector_info {
 	uint8_t is_sec80;
 	uint8_t blanking_status;
 	/* Padding bits to make struct size multiple of 4 bytes */
-	uint8_t padding_detector_info[0];
+	uint8_t padding_detector_info[];
 } __packed;
 
 /* Compile time assert to check struct size is divisible by 4 Bytes */
@@ -641,7 +641,7 @@ struct spectral_samp_msg {
 	uint8_t dcs_enabled;
 	uint8_t int_type;
 	uint8_t num_freq_spans;
-	uint8_t bin_pwr[0];  /*This should be the last item in the structure*/
+	uint8_t bin_pwr[];  /*This should be the last item in the structure*/
 } __packed;
 
 #else

+ 3 - 3
target_if/spectral/target_if_spectral.h

@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 2011,2017-2021 The Linux Foundation. All rights reserved.
- * Copyright (c) 2021-2023 Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) 2021-2024 Qualcomm Innovation Center, Inc. All rights reserved.
  *
  * Permission to use, copy, modify, and/or distribute this software for
  * any purpose with or without fee is hereby granted, provided that the
@@ -285,7 +285,7 @@ typedef uint32_t SPECTRAL_SEGID_INFO;
  * @buf: fft report
  */
 struct spectral_phyerr_fft_gen2 {
-	uint8_t buf[0];
+	__QDF_DECLARE_FLEX_ARRAY(uint8_t, buf);
 };
 
 /**
@@ -463,7 +463,7 @@ struct spectral_phyerr_fft_report_gen3 {
 	uint32_t hdr_b;
 	uint32_t hdr_c;
 	uint32_t resv;
-	uint8_t buf[0];
+	uint8_t buf[];
 } __ATTRIB_PACK;
 
 /**

+ 2 - 2
umac/cmn_services/regulatory/inc/wlan_reg_afc.h

@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 2021, The Linux Foundation. All rights reserved.
- * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) 2022-2024 Qualcomm Innovation Center, Inc. All rights reserved.
  *
  * Permission to use, copy, modify, and/or distribute this software for any
  * purpose with or without fee is hereby granted, provided that the above
@@ -180,7 +180,7 @@ struct wlan_afc_host_resp {
 	uint32_t time_to_live;
 	uint32_t length;
 	uint32_t resp_format;
-	uint8_t  afc_resp[0];
+	uint8_t afc_resp[];
 } qdf_packed;
 
 /**

+ 3 - 3
umac/dfs/dispatcher/inc/wlan_dfs_ioctl.h

@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 2011, 2016-2021 The Linux Foundation. All rights reserved.
- * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) 2022-2024 Qualcomm Innovation Center, Inc. All rights reserved.
  * Copyright (c) 2010, Atheros Communications Inc.
  * All Rights Reserved.
  *
@@ -358,7 +358,7 @@ struct synthetic_pulse {
 struct synthetic_seq {
 	uint8_t num_pulses;
 	uint32_t total_len_seq;
-	struct synthetic_pulse *pulse[0];
+	struct synthetic_pulse *pulse[];
 };
 
 /**
@@ -370,7 +370,7 @@ struct synthetic_seq {
 
 struct seq_store {
 	uint8_t num_sequence;
-	struct synthetic_seq *seq_arr[0];
+	struct synthetic_seq *seq_arr[];
 };
 #endif /* WLAN_DFS_PARTIAL_OFFLOAD && WLAN_DFS_SYNTHETIC_RADAR */
 

+ 1 - 1
wmi/inc/wmi_unified_param.h

@@ -9149,7 +9149,7 @@ struct wmi_roam_scan_stats_params {
  */
 struct wmi_roam_scan_stats_res {
 	uint32_t num_roam_scans;
-	struct wmi_roam_scan_stats_params roam_scan[0];
+	struct wmi_roam_scan_stats_params roam_scan[];
 };
 
 #define MAX_ROAM_CANDIDATE_AP    9

+ 1 - 1
wmi/inc/wmi_unified_priv.h

@@ -158,7 +158,7 @@ struct wmi_ext_dbg_msg {
 	uint32_t len;
 	uint64_t ts;
 	enum WMI_MSG_TYPE type;
-	uint8_t buf[0];
+	uint8_t buf[];
 };
 #endif /*WMI_EXT_DBG */