diff mbox series

udp: reduce padding field unused to 1-byte in struct udp_sock

Message ID 126b8cf1-0b44-ee99-8598-a10acebc5a47@163.com (mailing list archive)
State Changes Requested
Delegated to: Netdev Maintainers
Headers show
Series udp: reduce padding field unused to 1-byte in struct udp_sock | expand

Checks

Context Check Description
netdev/tree_selection success Not a local patch

Commit Message

Jianguo Wu Oct. 21, 2021, 10:27 a.m. UTC
From: Jianguo Wu <wujianguo@chinatelecom.cn>

In commit 342f0234c71b ("[UDP]: Introduce UDP encapsulation type for L2TP"),
it includes a padding field(__u8 unused[3]) to put the new encap_rcv field
on a 4-byte boundary.

But commit bec1f6f69736 ("udp: generate gso with UDP_SEGMENT") and a new 2-bytes
field gso_size, so we should cut 2-bytes padding.

Fixes: bec1f6f69736 udp: generate gso with UDP_SEGMENT)
Signed-off-by: Jianguo Wu <wujianguo@chinatelecom.cn>
---
 include/linux/udp.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Paolo Abeni Oct. 21, 2021, 10:44 a.m. UTC | #1
Hello,

On Thu, 2021-10-21 at 18:27 +0800, Jianguo Wu wrote:
> From: Jianguo Wu <wujianguo@chinatelecom.cn>
> 
> In commit 342f0234c71b ("[UDP]: Introduce UDP encapsulation type for L2TP"),
> it includes a padding field(__u8 unused[3]) to put the new encap_rcv field
> on a 4-byte boundary.
> 
> But commit bec1f6f69736 ("udp: generate gso with UDP_SEGMENT") and a new 2-bytes
> field gso_size, so we should cut 2-bytes padding.
> 
> Fixes: bec1f6f69736 udp: generate gso with UDP_SEGMENT)
> Signed-off-by: Jianguo Wu <wujianguo@chinatelecom.cn>
> ---
>  include/linux/udp.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/include/linux/udp.h b/include/linux/udp.h
> index ae66dad..c1b4e5b 100644
> --- a/include/linux/udp.h
> +++ b/include/linux/udp.h
> @@ -70,7 +70,7 @@ struct udp_sock {
>  #define UDPLITE_SEND_CC  0x2  		/* set via udplite setsockopt         */
>  #define UDPLITE_RECV_CC  0x4		/* set via udplite setsocktopt        */
>  	__u8		 pcflag;        /* marks socket as UDP-Lite if > 0    */
> -	__u8		 unused[3];
> +	__u8		 unused;
>  	/*
>  	 * For encapsulation sockets.
>  	 */

Note that after this patch we will have a 4 bytes hole on 64bits
arches.

My personal take is that we can as well drop the 'unused' field:
someone intentioned to modify the 'udp_sock' struct should have a look
at the binary layout anyway.

Cheers,

Paolo
diff mbox series

Patch

diff --git a/include/linux/udp.h b/include/linux/udp.h
index ae66dad..c1b4e5b 100644
--- a/include/linux/udp.h
+++ b/include/linux/udp.h
@@ -70,7 +70,7 @@  struct udp_sock {
 #define UDPLITE_SEND_CC  0x2  		/* set via udplite setsockopt         */
 #define UDPLITE_RECV_CC  0x4		/* set via udplite setsocktopt        */
 	__u8		 pcflag;        /* marks socket as UDP-Lite if > 0    */
-	__u8		 unused[3];
+	__u8		 unused;
 	/*
 	 * For encapsulation sockets.
 	 */