Re: [PATCH v2 bpf-next 1/3] bpf: Add casts to keep sparse quiet.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2024-07-03 14:39:16 [-0700], Alexei Starovoitov wrote:
> > diff --git a/include/uapi/linux/bpf.h b/include/uapi/linux/bpf.h
> > index 25ea393cf084b..f45b03706e4e9 100644
> > --- a/include/uapi/linux/bpf.h
> > +++ b/include/uapi/linux/bpf.h
> > @@ -6290,12 +6290,12 @@ struct bpf_tunnel_key {
> >   */
> >  struct bpf_xfrm_state {
> >         __u32 reqid;
> > -       __u32 spi;      /* Stored in network byte order */
> > +       __be32 spi;     /* Stored in network byte order */
> >         __u16 family;
> >         __u16 ext;      /* Padding, future use. */
> >         union {
> > -               __u32 remote_ipv4;      /* Stored in network byte order */
> > -               __u32 remote_ipv6[4];   /* Stored in network byte order */
> > +               __be32 remote_ipv4;     /* Stored in network byte order */
> > +               __be32 remote_ipv6[4];  /* Stored in network byte order */
> >         };
> >  };
> 
> I don't think we should be changing uapi because of sparse.
> I would ignore the warnings.

There are other struct member within this bpf.h which use __be32 so it
is known to userland (in terms of the compiler won't complain about an
unknown type due to missing include). The type is essentially the same
since the __bitwise attribute is empty except for sparse (which defines
__CHECKER_).
Therefore I wouldn't say this changes the uapi in an incompatible way.

Sebastian




[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux