Messages in this thread | | | From | Menglong Dong <> | Date | Wed, 17 Mar 2021 21:53:23 +0800 | Subject | Re: [PATCH v4 RESEND net-next] net: socket: use BIT() for MSG_* |
| |
On Wed, Mar 17, 2021 at 5:36 PM Andy Shevchenko <andy.shevchenko@gmail.com> wrote: > ... > > The problematic code is negation of the flags when it's done in > operations like &. > It maybe fixed by swapping positions of the arguments, i.e. ~(FOO | > BAR) & flags. > > All this is a beast called "integer promotions" in the C standard. > > The best is to try to get flags to be unsigned. By how invasive it may be?
Seems that the inconsistent usages of 'msg_flags' is a lot, for example the 'recvmsg()' in 'struct proto' and 'recvmsg()' in 'struct proto_ops':
int (*recvmsg)(struct sock *sk, struct msghdr *msg, size_t len, int noblock, int flags, int *addr_len);
This function prototype is used in many places, It's not easy to fix them. This patch is already reverted, and I think maybe I can resend it after I fix these 'int' flags.
> > -- > With Best Regards, > Andy Shevchenko
Thanks! Menglong Dong
| |