Skip to content

Commit

Permalink
mctp: unify sockaddr_mctp types
Browse files Browse the repository at this point in the history
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.

Fixes: 60fc639 ("mctp: Add sockaddr_mctp to uapi")
Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>
Acked-by: Eugene Syromiatnikov <esyr@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Jeremy Kerr authored and David S. Miller committed Oct 18, 2021
1 parent b2cddb4 commit b416beb
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
10 changes: 5 additions & 5 deletions Documentation/networking/mctp.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion include/net/mctp.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
5 changes: 3 additions & 2 deletions include/uapi/linux/mctp.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#define __UAPI_MCTP_H

#include <linux/types.h>
#include <linux/socket.h>

typedef __u8 mctp_eid_t;

Expand All @@ -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;
Expand Down

0 comments on commit b416beb

Please sign in to comment.