On Wed, Oct 15, 2025 at 01:15:19PM +0100, Simon Horman wrote:
> On Tue, Oct 14, 2025 at 03:43:25PM -0700, Kees Cook wrote:
> > Update all struct proto_ops bind() callback function prototypes from
> > "struct sockaddr *" to "struct sockaddr_unspec *" to avoid lying to the
> > compiler about object sizes. Calls into struct proto handlers gain casts
> > that will be removed in the struct proto conversion patch.
> > 
> > No binary changes expected.
> > 
> > Signed-off-by: Kees Cook <[email protected]>
> 
> ...
> 
> > diff --git a/net/mctp/af_mctp.c b/net/mctp/af_mctp.c
> > index b99ba14f39d2..0a795901e4f2 100644
> > --- a/net/mctp/af_mctp.c
> > +++ b/net/mctp/af_mctp.c
> > @@ -49,7 +49,7 @@ static bool mctp_sockaddr_ext_is_ok(const struct 
> > sockaddr_mctp_ext *addr)
> >            !addr->__smctp_pad0[2];
> >  }
> >  
> > -static int mctp_bind(struct socket *sock, struct sockaddr *addr, int 
> > addrlen)
> > +static int mctp_bind(struct socket *sock, struct sockaddr_unspec *addr, 
> > int addrlen)
> >  {
> >     struct sock *sk = sock->sk;
> >     struct mctp_sock *msk = container_of(sk, struct mctp_sock, sk);
> > @@ -128,7 +128,7 @@ static int mctp_bind(struct socket *sock, struct 
> > sockaddr *addr, int addrlen)
> >  /* Used to set a specific peer prior to bind. Not used for outbound
> >   * connections (Tag Owner set) since MCTP is a datagram protocol.
> >   */
> > -static int mctp_connect(struct socket *sock, struct sockaddr *addr,
> > +static int mctp_connect(struct socket *sock, struct sockaddr_unspec *addr,
> >                     int addrlen, int flags)
> >  {
> >     struct sock *sk = sock->sk;
> 
> Hi Kees,
> 
> The change to mctp_connect() results GCC 15.2.0 warning as follows:
> 
> net/mctp/af_mctp.c:632:27: error: initialization of 'int (*)(struct socket *, 
> struct sockaddr *, int,  int)' from incompatible pointer type 'int (*)(struct 
> socket *, struct sockaddr_unspec *, int,  int)' [-Wincompatible-pointer-types]
>   632 |         .connect        = mctp_connect,
>       |                           ^~~~~~~~~~~~
> 
> As I don't see other _connect functions updated in this patch,
> perhaps it is out of place here and should be dropped from this patch.

Whoops, yes. Thank you! This should be part of the "connect" proto_ops
patch. I'm not sure how it ended up in here. I will move it. :)

-Kees

-- 
Kees Cook

Reply via email to