Skip to contentSkip to conversation

i40e: Replace one-element arrays with flexible-array members

GIT PULL New Tony Nguyen 2 participants 6 messages Aug 10, 2023 – Aug 12, 2023

Subsystems (3)
lore
Share & tools
lore

Tony Nguyen

author maintainer
#0 lore raw

Gustavo A. R. Silva says:

Replace one-element arrays with flexible-array members in multiple structures.

This results in no differences in binary output.

The following are changes since commit 29afcd69672a4e3d8604d17206d42004540d6d5c:
Merge branch 'improve-the-taprio-qdisc-s-relationship-with-its-children'
and are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/next-queue 40GbE

Gustavo A. R. Silva (4):
i40e: Replace one-element array with flex-array member in struct
i40e_package_header
i40e: Replace one-element array with flex-array member in struct
i40e_profile_segment
i40e: Replace one-element array with flex-array member in struct
i40e_section_table
i40e: Replace one-element array with flex-array member in struct
i40e_profile_aq_section

 drivers/net/ethernet/intel/i40e/i40e_ddp.c  | 4 ++--
 drivers/net/ethernet/intel/i40e/i40e_type.h | 8 ++++----
 2 files changed, 6 insertions(+), 6 deletions(-)
Signature · 1 line
2.38.1
author maintainer
#1 lore raw

PATCH 1/4 i40e: Replace one-element array with flex-array member in struct i40e_package_header

From: "Gustavo A. R. Silva" <[email protected]>

One-element and zero-length arrays are deprecated. So, replace one-element array in struct i40e_package_header with flexible-array member.

The + sizeof(u32) adjustments ensure that there are no differences in binary output.

---
 drivers/net/ethernet/intel/i40e/i40e_ddp.c  | 4 ++--
 drivers/net/ethernet/intel/i40e/i40e_type.h | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_ddp.c +2 -2
index 969120587cad..0e72abd178ae 100644
@@ -220,7 +220,7 @@ static bool i40e_ddp_is_pkg_hdr_valid(struct net_device *netdev,
 		netdev_err(netdev, "Invalid DDP profile - size is bigger than 4G");
 		return false;
 	}
-	if (size < (sizeof(struct i40e_package_header) +
+	if (size < (sizeof(struct i40e_package_header) + sizeof(u32) +
 		sizeof(struct i40e_metadata_segment) + sizeof(u32) * 2)) {
 		netdev_err(netdev, "Invalid DDP profile - size is too small.");
 		return false;
@@ -281,7 +281,7 @@ int i40e_ddp_load(struct net_device *netdev, const u8 *data, size_t size,
 	if (!i40e_ddp_is_pkg_hdr_valid(netdev, pkg_hdr, size))
 		return -EINVAL;
 
-	if (size < (sizeof(struct i40e_package_header) +
+	if (size < (sizeof(struct i40e_package_header) + sizeof(u32) +
 		    sizeof(struct i40e_metadata_segment) + sizeof(u32) * 2)) {
 		netdev_err(netdev, "Invalid DDP recipe size.");
 		return -EINVAL;
drivers/net/ethernet/intel/i40e/i40e_type.h +1 -1
index 5f61546f50d8..08ad83ee4a43 100644
@@ -1455,7 +1455,7 @@ struct i40e_ddp_version {
 struct i40e_package_header {
 	struct i40e_ddp_version version;
 	u32 segment_count;
-	u32 segment_offset[1];
+	u32 segment_offset[];
 };
 
 /* Generic segment header */
Signature · 1 line
2.38.1
author maintainer
#2 lore raw

PATCH 2/4 i40e: Replace one-element array with flex-array member in struct i40e_profile_segment

In reply to Tony Nguyen

From: "Gustavo A. R. Silva" <[email protected]>

One-element and zero-length arrays are deprecated. So, replace one-element array in struct i40e_profile_segment with flexible-array member.

This results in no differences in binary output.

---
 drivers/net/ethernet/intel/i40e/i40e_type.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/intel/i40e/i40e_type.h +1 -1
index 08ad83ee4a43..6cbc3dbf9b03 100644
@@ -1486,7 +1486,7 @@ struct i40e_profile_segment {
 	struct i40e_ddp_version version;
 	char name[I40E_DDP_NAME_SIZE];
 	u32 device_table_count;
-	struct i40e_device_id_entry device_table[1];
+	struct i40e_device_id_entry device_table[];
 };
 
 struct i40e_section_table {
Signature · 1 line
2.38.1
author maintainer
#3 lore raw

PATCH 3/4 i40e: Replace one-element array with flex-array member in struct i40e_section_table

In reply to Tony Nguyen

From: "Gustavo A. R. Silva" <[email protected]>

One-element and zero-length arrays are deprecated. So, replace one-element array in struct i40e_section_table with flexible-array member.

This results in no differences in binary output.

---
 drivers/net/ethernet/intel/i40e/i40e_type.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/intel/i40e/i40e_type.h +1 -1
index 6cbc3dbf9b03..8ad878ff02cf 100644
@@ -1491,7 +1491,7 @@ struct i40e_profile_segment {
 
 struct i40e_section_table {
 	u32 section_count;
-	u32 section_offset[1];
+	u32 section_offset[];
 };
 
 struct i40e_profile_section_header {
Signature · 1 line
2.38.1
author maintainer
#4 lore raw

PATCH 4/4 i40e: Replace one-element array with flex-array member in struct i40e_profile_aq_section

In reply to Tony Nguyen

From: "Gustavo A. R. Silva" <[email protected]>

One-element and zero-length arrays are deprecated. So, replace one-element array in struct i40e_profile_aq_section with flexible-array member.

This results in no differences in binary output.

---
 drivers/net/ethernet/intel/i40e/i40e_type.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/intel/i40e/i40e_type.h +1 -1
index 8ad878ff02cf..232131bedc3e 100644
@@ -1523,7 +1523,7 @@ struct i40e_profile_aq_section {
 	u16 flags;
 	u8  param[16];
 	u16 datalen;
-	u8  data[1];
+	u8  data[];
 };
 
 struct i40e_profile_info {
Signature · 1 line
2.38.1
#5 lore raw
In reply to Tony Nguyen
This series was applied to netdev/net-next.git (main) by Tony Nguyen <[email protected]>:

Hello:

This series was applied to netdev/net-next.git (main) by Tony Nguyen <[email protected]>:

Quoted 8 lines · On Thu, 10 Aug 2023 10:52:58 -0700 you wrote:

Gustavo A. R. Silva says:

Replace one-element arrays with flexible-array members in multiple structures.

This results in no differences in binary output.

[...]

Here is the summary with links:
- [net-next,1/4] i40e: Replace one-element array with flex-array member in struct i40e_package_header

    https://git.kernel.org/netdev/net-next/c/e55c50eac36a
  - [net-next,2/4] i40e: Replace one-element array with flex-array member in struct i40e_profile_segment
    https://git.kernel.org/netdev/net-next/c/fbfa49f92484
  - [net-next,3/4] i40e: Replace one-element array with flex-array member in struct i40e_section_table
    https://git.kernel.org/netdev/net-next/c/ff1a724c4f6a
  - [net-next,4/4] i40e: Replace one-element array with flex-array member in struct i40e_profile_aq_section
    https://git.kernel.org/netdev/net-next/c/4bb28b27040b

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html