linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: fixup address-space warnings in compat_mc_{get,set}sockopt()
@ 2019-03-01 18:39 Ben Dooks
  2019-03-04  4:58 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Ben Dooks @ 2019-03-01 18:39 UTC (permalink / raw)
  To: netdev; +Cc: linux-kernel, David S . Miller, linux-kernel, Ben Dooks

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>*gr32
net/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>*gsr32
net/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>*gf32
net/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>*gf32
net/compat.c:672:52:    got void *<noident>

Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
---
 net/compat.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/net/compat.c b/net/compat.c
index 3d348198004f..8c8c57d814af 100644
--- a/net/compat.c
+++ b/net/compat.c
@@ -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;
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] net: fixup address-space warnings in compat_mc_{get,set}sockopt()
  2019-03-01 18:39 [PATCH] net: fixup address-space warnings in compat_mc_{get,set}sockopt() Ben Dooks
@ 2019-03-04  4:58 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2019-03-04  4:58 UTC (permalink / raw)
  To: ben.dooks; +Cc: netdev, linux-kernel, linux-kernel

From: Ben Dooks <ben.dooks@codethink.co.uk>
Date: Fri,  1 Mar 2019 18:39:44 +0000

> 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>*gr32
> net/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>*gsr32
> net/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>*gf32
> net/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>*gf32
> net/compat.c:672:52:    got void *<noident>
> 
> Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>

Applied to net-next, thanks.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-03-04  4:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-01 18:39 [PATCH] net: fixup address-space warnings in compat_mc_{get,set}sockopt() Ben Dooks
2019-03-04  4:58 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).