Re: [PATCH v4 RESEND net-next] net: socket: use BIT() for MSG_*

2021-03-17 Thread Menglong Dong
On Wed, Mar 17, 2021 at 11:12 PM David Laight wrote: > ... > > Isn't MSG_CMSG_COMPAT an internal value? > Could it be changed to 1u << 30 instead of 1u << 31 ? > Then it wouldn't matter if the high bit of flags got replicated. > Yeah, MSG_CMSG_COMPAT is an internal value, and maybe it's why it is

Re: [PATCH v4 RESEND net-next] net: socket: use BIT() for MSG_*

2021-03-17 Thread David Miller
From: Menglong Dong Date: Wed, 17 Mar 2021 16:21:14 +0800 > Hello, > > On Wed, Mar 17, 2021 at 9:38 AM Guenter Roeck wrote: >> >> On Wed, Mar 17, 2021 at 01:02:51AM +0200, Andy Shevchenko wrote: >> > On Wednesday, March 17, 2021, Guenter Roeck wrote: >> > > ... >> >> The problem is in net/pack

Re: [PATCH v4 RESEND net-next] net: socket: use BIT() for MSG_*

2021-03-17 Thread Guenter Roeck
On Wed, Mar 17, 2021 at 09:53:23PM +0800, Menglong Dong wrote: > On Wed, Mar 17, 2021 at 5:36 PM Andy Shevchenko > 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 |

RE: [PATCH v4 RESEND net-next] net: socket: use BIT() for MSG_*

2021-03-17 Thread David Laight
From: Guenter Roeck > Sent: 17 March 2021 01:38 ... > MSG_CMSG_COMPAT (0x8000) is set in flags, meaning its value is negative. > This is then evaluated in > >if (flags & > ~(MSG_PEEK|MSG_DONTWAIT|MSG_TRUNC|MSG_CMSG_COMPAT|MSG_ERRQUEUE)) > goto out; > > If any of those

Re: [PATCH v4 RESEND net-next] net: socket: use BIT() for MSG_*

2021-03-17 Thread Menglong Dong
On Wed, Mar 17, 2021 at 9:53 PM Menglong Dong wrote: > ... > > 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 nobloc

Re: [PATCH v4 RESEND net-next] net: socket: use BIT() for MSG_*

2021-03-17 Thread Menglong Dong
On Wed, Mar 17, 2021 at 5:36 PM Andy Shevchenko 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 s

Re: [PATCH v4 RESEND net-next] net: socket: use BIT() for MSG_*

2021-03-17 Thread Guenter Roeck
On 3/17/21 2:40 AM, Andy Shevchenko wrote: > On Wed, Mar 17, 2021 at 11:36 AM Andy Shevchenko > wrote: >> On Wed, Mar 17, 2021 at 10:21 AM Menglong Dong >> wrote: > > ... > >> It maybe fixed by swapping positions of the arguments, i.e. ~(FOO | >> BAR) & flags. > > ...and type casting will be

Re: [PATCH v4 RESEND net-next] net: socket: use BIT() for MSG_*

2021-03-17 Thread Andy Shevchenko
On Wed, Mar 17, 2021 at 11:36 AM Andy Shevchenko wrote: > On Wed, Mar 17, 2021 at 10:21 AM Menglong Dong > wrote: ... > It maybe fixed by swapping positions of the arguments, i.e. ~(FOO | > BAR) & flags. ...and type casting will be needed anyway here... I was thinking about this case driver

Re: [PATCH v4 RESEND net-next] net: socket: use BIT() for MSG_*

2021-03-17 Thread Andy Shevchenko
On Wed, Mar 17, 2021 at 10:21 AM Menglong Dong wrote: > On Wed, Mar 17, 2021 at 9:38 AM Guenter Roeck wrote: > > On Wed, Mar 17, 2021 at 01:02:51AM +0200, Andy Shevchenko wrote: > > > On Wednesday, March 17, 2021, Guenter Roeck wrote: > > > > ... > > > > The problem is in net/packet/af_packet.c:

Re: [PATCH v4 RESEND net-next] net: socket: use BIT() for MSG_*

2021-03-17 Thread Menglong Dong
Hello, On Wed, Mar 17, 2021 at 9:38 AM Guenter Roeck wrote: > > On Wed, Mar 17, 2021 at 01:02:51AM +0200, Andy Shevchenko wrote: > > On Wednesday, March 17, 2021, Guenter Roeck wrote: > > ... > > The problem is in net/packet/af_packet.c:packet_recvmsg(). This function, > as well as all other rcv

Re: [PATCH v4 RESEND net-next] net: socket: use BIT() for MSG_*

2021-03-16 Thread Guenter Roeck
On Wed, Mar 17, 2021 at 01:02:51AM +0200, Andy Shevchenko wrote: > On Wednesday, March 17, 2021, Guenter Roeck wrote: > > > Hi, > > > > On Tue, Mar 09, 2021 at 05:51:35PM -0800, menglong8.d...@gmail.com wrote: > > > From: Menglong Dong > > > > > > The bit mask for MSG_* seems a little confused h

Re: [PATCH v4 RESEND net-next] net: socket: use BIT() for MSG_*

2021-03-16 Thread Guenter Roeck
On 3/16/21 4:02 PM, Andy Shevchenko wrote: > > > On Wednesday, March 17, 2021, Guenter Roeck > wrote: > > Hi, > > On Tue, Mar 09, 2021 at 05:51:35PM -0800, menglong8.d...@gmail.com > wrote: > > From: Menglong Dong

Re: [PATCH v4 RESEND net-next] net: socket: use BIT() for MSG_*

2021-03-16 Thread Guenter Roeck
Hi, On Tue, Mar 09, 2021 at 05:51:35PM -0800, menglong8.d...@gmail.com wrote: > From: Menglong Dong > > The bit mask for MSG_* seems a little confused here. Replace it > with BIT() to make it clear to understand. > > Signed-off-by: Menglong Dong I must admit that I am a bit puzzled, but with

Re: [PATCH v4 RESEND net-next] net: socket: use BIT() for MSG_*

2021-03-10 Thread patchwork-bot+netdevbpf
Hello: This patch was applied to netdev/net-next.git (refs/heads/master): On Tue, 9 Mar 2021 17:51:35 -0800 you wrote: > From: Menglong Dong > > The bit mask for MSG_* seems a little confused here. Replace it > with BIT() to make it clear to understand. > > Signed-off-by: Menglong Dong > >

[PATCH v4 RESEND net-next] net: socket: use BIT() for MSG_*

2021-03-09 Thread menglong8 . dong
From: Menglong Dong The bit mask for MSG_* seems a little confused here. Replace it with BIT() to make it clear to understand. Signed-off-by: Menglong Dong --- v4: - CC netdev v3: - move changelog here v2: - use BIT() instead of BIT_MASK() --- include/linux/socket.h | 71 ++