linux-hyperv.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] hv_netvsc: Replace one-element array with flexible array member
@ 2025-01-16 20:16 Thorsten Blum
  2025-01-16 20:45 ` Roman Kisel
  0 siblings, 1 reply; 3+ messages in thread
From: Thorsten Blum @ 2025-01-16 20:16 UTC (permalink / raw)
  To: K. Y. Srinivasan, Haiyang Zhang, Wei Liu, Dexuan Cui, Andrew Lunn,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni
  Cc: linux-hardening, Thorsten Blum, linux-hyperv, netdev,
	linux-kernel

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;
 
 /*
-- 
2.48.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] hv_netvsc: Replace one-element array with flexible array member
  2025-01-16 20:16 [PATCH] hv_netvsc: Replace one-element array with flexible array member Thorsten Blum
@ 2025-01-16 20:45 ` Roman Kisel
  2025-01-16 21:14   ` Thorsten Blum
  0 siblings, 1 reply; 3+ messages in thread
From: Roman Kisel @ 2025-01-16 20:45 UTC (permalink / raw)
  To: Thorsten Blum, K. Y. Srinivasan, Haiyang Zhang, Wei Liu,
	Dexuan Cui, Andrew Lunn, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni
  Cc: linux-hardening, linux-hyperv, netdev, linux-kernel



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?

-- 
Thank you,
Roman


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] hv_netvsc: Replace one-element array with flexible array member
  2025-01-16 20:45 ` Roman Kisel
@ 2025-01-16 21:14   ` Thorsten Blum
  0 siblings, 0 replies; 3+ messages in thread
From: Thorsten Blum @ 2025-01-16 21:14 UTC (permalink / raw)
  To: Roman Kisel
  Cc: K. Y. Srinivasan, Haiyang Zhang, Wei Liu, Dexuan Cui, Andrew Lunn,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	linux-hardening, linux-hyperv, netdev, linux-kernel

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-01-16 21:14 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-16 20:16 [PATCH] hv_netvsc: Replace one-element array with flexible array member Thorsten Blum
2025-01-16 20:45 ` Roman Kisel
2025-01-16 21:14   ` Thorsten Blum

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).