diff mbox series

hv_netvsc: Replace one-element array with flexible array member

Message ID 20250116201635.47870-2-thorsten.blum@linux.dev (mailing list archive)
State Superseded
Delegated to: Netdev Maintainers
Headers show
Series hv_netvsc: Replace one-element array with flexible array member | expand

Checks

Context Check Description
netdev/series_format warning Single patches do not need cover letters; Target tree name not specified in the subject
netdev/tree_selection success Guessed tree name to be net-next
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/build_tools success No tools touched, skip
netdev/cc_maintainers success CCed 10 of 10 maintainers
netdev/build_clang success Errors and warnings before: 5 this patch: 5
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 8 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Thorsten Blum Jan. 16, 2025, 8:16 p.m. UTC
Replace the deprecated one-element array with a modern flexible array
member in the struct nvsp_1_message_send_receive_buffer_complete.

Link: https://github.com/KSPP/linux/issues/79
Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
---
 drivers/net/hyperv/hyperv_net.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Roman Kisel Jan. 16, 2025, 8:45 p.m. UTC | #1
On 1/16/2025 12:16 PM, Thorsten Blum wrote:
> Replace the deprecated one-element array with a modern flexible array
> member in the struct nvsp_1_message_send_receive_buffer_complete.
> 
> Link: https://github.com/KSPP/linux/issues/79
> Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
> ---
>   drivers/net/hyperv/hyperv_net.h | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/hyperv/hyperv_net.h b/drivers/net/hyperv/hyperv_net.h
> index e690b95b1bbb..234db693cefa 100644
> --- a/drivers/net/hyperv/hyperv_net.h
> +++ b/drivers/net/hyperv/hyperv_net.h
> @@ -464,7 +464,7 @@ struct nvsp_1_message_send_receive_buffer_complete {
>   	 *  LargeOffset                            SmallOffset
>   	 */
>   
> -	struct nvsp_1_receive_buffer_section sections[1];
> +	struct nvsp_1_receive_buffer_section sections[];
>   } __packed;
>   
>   /*

1. How have you tested the change?

2. There is an instance of

`sizeof(struct nvsp_1_message_send_receive_buffer_complete))`

and your change decreases the size of the struct. Why do you think
that is fine?
Thorsten Blum Jan. 16, 2025, 9:14 p.m. UTC | #2
On 16. Jan 2025, at 21:45, Roman Kisel wrote:
> On 1/16/2025 12:16 PM, Thorsten Blum wrote:
>> Replace the deprecated one-element array with a modern flexible array
>> member in the struct nvsp_1_message_send_receive_buffer_complete.
>> Link: https://github.com/KSPP/linux/issues/79
>> Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
>> ---
>>  drivers/net/hyperv/hyperv_net.h | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>> diff --git a/drivers/net/hyperv/hyperv_net.h b/drivers/net/hyperv/hyperv_net.h
>> index e690b95b1bbb..234db693cefa 100644
>> --- a/drivers/net/hyperv/hyperv_net.h
>> +++ b/drivers/net/hyperv/hyperv_net.h
>> @@ -464,7 +464,7 @@ struct nvsp_1_message_send_receive_buffer_complete {
>>    *  LargeOffset                            SmallOffset
>>    */
>>  - struct nvsp_1_receive_buffer_section sections[1];
>> + struct nvsp_1_receive_buffer_section sections[];
>>  } __packed;
>>    /*
> 
> 1. How have you tested the change?

Compile-tested only.

> 2. There is an instance of
> 
> `sizeof(struct nvsp_1_message_send_receive_buffer_complete))`
> 
> and your change decreases the size of the struct. Why do you think
> that is fine?

Sorry, I actually changed this to struct_size_t(,,1), but forgot to add
it to the commit - will submit a v2 shortly.

Thanks,
Thorsten
diff mbox series

Patch

diff --git a/drivers/net/hyperv/hyperv_net.h b/drivers/net/hyperv/hyperv_net.h
index e690b95b1bbb..234db693cefa 100644
--- a/drivers/net/hyperv/hyperv_net.h
+++ b/drivers/net/hyperv/hyperv_net.h
@@ -464,7 +464,7 @@  struct nvsp_1_message_send_receive_buffer_complete {
 	 *  LargeOffset                            SmallOffset
 	 */
 
-	struct nvsp_1_receive_buffer_section sections[1];
+	struct nvsp_1_receive_buffer_section sections[];
 } __packed;
 
 /*