mctp: unify sockaddr_mctp types
Subsystems (4)
Jeremy Kerr
maintainerPATCH 2/2 mctp: Be explicit about struct sockaddr_mctp padding
In reply to Jeremy KerrWe currently have some implicit padding in struct sockaddr_mctp. This patch makes this padding explicit, and ensures we have consistent layout on platforms with <32bit alignmnent.
--- include/uapi/linux/mctp.h | 2 ++ 1 file changed, 2 insertions(+)
include/uapi/linux/mctp.h +2 -0
@@ -20,10 +20,12 @@ struct mctp_addr {struct sockaddr_mctp {__kernel_sa_family_t smctp_family; +__u16 __smctp_pad0;unsigned int smctp_network;struct mctp_addr smctp_addr;__u8 smctp_type;__u8 smctp_tag; +__u8 __smctp_pad1; };#define MCTP_NET_ANY 0x0
Signature · 1 line
2.30.2
Jeremy Kerr
maintainerPATCH 1/2 mctp: unify sockaddr_mctp types
Use the more precise __kernel_sa_family_t for smctp_family, to match struct sockaddr.
Also, use an unsigned int for the network member; negative networks don't make much sense. We're already using unsigned for mctp_dev and mctp_skb_cb, but need to change mctp_sock to suit.
--- Documentation/networking/mctp.rst | 10 +++++----- include/net/mctp.h | 2 +- include/uapi/linux/mctp.h | 5 +++-- 3 files changed, 9 insertions(+), 8 deletions(-)
Documentation/networking/mctp.rst +5 -5
@@ -59,11 +59,11 @@ specified with a ``sockaddr`` type, with a single-byte endpoint address: }; struct sockaddr_mctp { - unsigned short int smctp_family; - int smctp_network; - struct mctp_addr smctp_addr; - __u8 smctp_type; - __u8 smctp_tag; + __kernel_sa_family_t smctp_family; + unsigned int smctp_network; + struct mctp_addr smctp_addr; + __u8 smctp_type; + __u8 smctp_tag; }; #define MCTP_NET_ANY 0x0
include/net/mctp.h +1 -1
@@ -54,7 +54,7 @@ struct mctp_sock {struct sock sk;/* bind() params */ -int bind_net; +unsigned int bind_net;mctp_eid_t bind_addr;__u8 bind_type;
include/uapi/linux/mctp.h +3 -2
@@ -10,6 +10,7 @@#define __UAPI_MCTP_H#include <linux/types.h> +#include <linux/socket.h> typedef __u8 mctp_eid_t ;
@@ -18,8 +19,8 @@ struct mctp_addr { };struct sockaddr_mctp { -unsigned short int smctp_family; -int smctp_network; +__kernel_sa_family_t smctp_family; +unsigned int smctp_network;struct mctp_addr smctp_addr;__u8 smctp_type;__u8 smctp_tag;
Signature · 1 line
2.30.2
Quoted 9 lines · Jeremy Kerr
Use the more precise
__kernel_sa_family_tforsmctp_family, to match struct sockaddr.Also, use an unsigned int for the network member; negative networks don't make much sense. We're already using unsigned for
mctp_devandmctp_skb_cb, but need to changemctp_sockto suit.Fixes 60fc63981693 ("mctp: Add sockaddr_mctp to uapi")Signed-off-by Jeremy Kerr <[email protected]>
Re: [PATCH net 2/2] mctp: Be explicit about struct sockaddr_mctp padding
In reply to Jeremy KerrQuoted 6 lines · Jeremy Kerr
We currently have some implicit padding in struct
sockaddr_mctp. This patch makes this padding explicit, and ensures we have consistent layout on platforms with <32bit alignmnent.Fixes 60fc63981693 ("mctp: Add sockaddr_mctp to uapi")Signed-off-by Jeremy Kerr <[email protected]>
This series was applied to netdev/net.git (master) by David S. Miller <[email protected]>:
Hello:
This series was applied to netdev/net.git (master) by David S. Miller <[email protected]>:
Quoted 8 lines · On Mon, 18 Oct 2021 11:29:34 +0800 you wrote:
Use the more precise
__kernel_sa_family_tforsmctp_family, to match struct sockaddr.Also, use an unsigned int for the network member; negative networks don't make much sense. We're already using unsigned for
mctp_devandmctp_skb_cb, but need to changemctp_sockto suit.[...]
Here is the summary with links:
- [net,1/2] mctp: unify sockaddr_mctp types
https://git.kernel.org/netdev/net/c/b416beb25d93 - [net,2/2] mctp: Be explicit about struct sockaddr_mctp padding https://git.kernel.org/netdev/net/c/5a20dd46b8b8
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html