net: fixup address-space warnings in compat_mc_{get,set}sockopt()
Subsystems (2)
PATCH 1/1 net: fixup address-space warnings in compat_mc_{get,set}sockopt()
Add __user attributes in some of the casts in this function to avoid the following sparse warnings:
net/compat.c:592:57: warning: cast removes address space of expression net/compat.c:592:57: warning: incorrect type in initializer (different address spaces)net/compat.c:592:57: expected struct compat_group_req [noderef] <asn:1>*gr32net/compat.c:592:57: got void *<noident>net/compat.c:613:65: warning: cast removes address space of expression net/compat.c:613:65: warning: incorrect type in initializer (different address spaces)net/compat.c:613:65: expected struct compat_group_source_req [noderef] <asn:1>*gsr32net/compat.c:613:65: got void *<noident>net/compat.c:634:60: warning: cast removes address space of expression net/compat.c:634:60: warning: incorrect type in initializer (different address spaces)net/compat.c:634:60: expected struct compat_group_filter [noderef] <asn:1>*gf32net/compat.c:634:60: got void *<noident>net/compat.c:672:52: warning: cast removes address space of expression net/compat.c:672:52: warning: incorrect type in initializer (different address spaces)net/compat.c:672:52: expected struct compat_group_filter [noderef] <asn:1>*gf32net/compat.c:672:52: got void *<noident>
--- net/compat.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
net/compat.c +4 -4
@@ -589,7 +589,7 @@ int compat_mc_setsockopt(struct sock *sock, int level, int optname,case MCAST_JOIN_GROUP :case MCAST_LEAVE_GROUP : { -struct compat_group_req __user *gr32 = (void *)optval; +struct compat_group_req __user *gr32 = (void __user *)optval;struct group_req __user *kgr =compat_alloc_user_space (sizeof (struct group_req ));u32 interface;
@@ -610,7 +610,7 @@ int compat_mc_setsockopt(struct sock *sock, int level, int optname,case MCAST_BLOCK_SOURCE :case MCAST_UNBLOCK_SOURCE : { -struct compat_group_source_req __user *gsr32 = (void *)optval; +struct compat_group_source_req __user *gsr32 = (void __user *)optval;struct group_source_req __user *kgsr =compat_alloc_user_space (sizeof (struct group_source_req ));u32 interface;
@@ -631,7 +631,7 @@ int compat_mc_setsockopt(struct sock *sock, int level, int optname, }case MCAST_MSFILTER : { -struct compat_group_filter __user *gf32 = (void *)optval; +struct compat_group_filter __user *gf32 = (void __user *)optval;struct group_filter __user *kgf;u32 interface, fmode, numsrc;
@@ -669,7 +669,7 @@ int compat_mc_getsockopt(struct sock *sock, int level, int optname, char __user *optval, int __user *optlen, int (*getsockopt)(struct sock *, int, int, char __user *, int __user *)) { - struct compat_group_filter __user *gf32 = (void *)optval; + struct compat_group_filter __user *gf32 = (void __user *)optval;struct group_filter __user *kgf;int __user *koptlen;u32 interface, fmode, numsrc;
Signature · 1 line
2.20.1
From: Ben Dooks <[email protected]>
Date: Fri, 1 Mar 2019 18:39:44 +0000
Quoted 20 lines
Add
__userattributes in some of the casts in this function to avoid the following sparse warnings:
net/compat.c:592:57: warning: cast removes address space of expressionnet/compat.c:592:57: warning: incorrect type in initializer (different address spaces)net/compat.c:592:57: expected structcompat_group_req[noderef] <asn:1>*gr32net/compat.c:592:57: got void *<noident>net/compat.c:613:65: warning: cast removes address space of expressionnet/compat.c:613:65: warning: incorrect type in initializer (different address spaces)net/compat.c:613:65: expected structcompat_group_source_req[noderef] <asn:1>*gsr32net/compat.c:613:65: got void *<noident>net/compat.c:634:60: warning: cast removes address space of expressionnet/compat.c:634:60: warning: incorrect type in initializer (different address spaces)net/compat.c:634:60: expected structcompat_group_filter[noderef] <asn:1>*gf32net/compat.c:634:60: got void *<noident>net/compat.c:672:52: warning: cast removes address space of expressionnet/compat.c:672:52: warning: incorrect type in initializer (different address spaces)net/compat.c:672:52: expected structcompat_group_filter[noderef] <asn:1>*gf32net/compat.c:672:52: got void *<noident>
Quoted 1 line
Signed-off-by Ben Dooks <[email protected]>
Applied to net-next, thanks.