Re: [PATCH 1/3] net: add a CMSG_USER_DATA macro

From: Sergei Shtylyov
Date: Tue May 12 2020 - 04:28:19 EST


Hello!

On 11.05.2020 14:59, Christoph Hellwig wrote:

Add a variant of CMSG_DATA that operates on user pointer to avoid
sparse warnings about casting to/from user pointers. Also fix up
CMSG_DATA to rely on the gcc extension that allows void pointer
arithmetics to cut down on the amount of casts.

Signed-off-by: Christoph Hellwig <hch@xxxxxx>
[...]
diff --git a/net/core/scm.c b/net/core/scm.c
index dc6fed1f221c4..abfdc85a64c1b 100644
--- a/net/core/scm.c
+++ b/net/core/scm.c
[...]
@@ -300,7 +300,7 @@ void scm_detach_fds(struct msghdr *msg, struct scm_cookie *scm)
if (fdnum < fdmax)
fdmax = fdnum;
- for (i=0, cmfptr=(__force int __user *)CMSG_DATA(cm); i<fdmax;
+ for (i=0, cmfptr =(int __user *)CMSG_USER_DATA(cm); i<fdmax;

Perhaps it's time to add missing spaces consistently, not just one that you added?

i++, cmfptr++)
{
struct socket *sock;

MBR, Sergei