* [PATCH net-next] ethtool: fix sparse warning
@ 2013-02-11 16:22 Stephen Hemminger
2013-02-11 17:21 ` Ben Hutchings
2013-02-11 19:18 ` David Miller
0 siblings, 2 replies; 3+ messages in thread
From: Stephen Hemminger @ 2013-02-11 16:22 UTC (permalink / raw)
To: David Miller, Ben Hutchings; +Cc: netdev
Fixes sparse complaints about dropping __user in casts.
warning: cast removes address space of expression
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
--- a/net/socket.c 2013-02-11 08:17:45.081011548 -0800
+++ b/net/socket.c 2013-02-11 08:19:52.743355382 -0800
@@ -2837,7 +2837,7 @@ static int ethtool_ioctl(struct net *net
}
ifr = compat_alloc_user_space(buf_size);
- rxnfc = (void *)ifr + ALIGN(sizeof(struct ifreq), 8);
+ rxnfc = (void __user *)ifr + ALIGN(sizeof(struct ifreq), 8);
if (copy_in_user(&ifr->ifr_name, &ifr32->ifr_name, IFNAMSIZ))
return -EFAULT;
@@ -2861,12 +2861,12 @@ static int ethtool_ioctl(struct net *net
offsetof(struct ethtool_rxnfc, fs.ring_cookie));
if (copy_in_user(rxnfc, compat_rxnfc,
- (void *)(&rxnfc->fs.m_ext + 1) -
- (void *)rxnfc) ||
+ (void __user *)(&rxnfc->fs.m_ext + 1) -
+ (void __user *)rxnfc) ||
copy_in_user(&rxnfc->fs.ring_cookie,
&compat_rxnfc->fs.ring_cookie,
- (void *)(&rxnfc->fs.location + 1) -
- (void *)&rxnfc->fs.ring_cookie) ||
+ (void __user *)(&rxnfc->fs.location + 1) -
+ (void __user *)&rxnfc->fs.ring_cookie) ||
copy_in_user(&rxnfc->rule_cnt, &compat_rxnfc->rule_cnt,
sizeof(rxnfc->rule_cnt)))
return -EFAULT;
@@ -2878,12 +2878,12 @@ static int ethtool_ioctl(struct net *net
if (convert_out) {
if (copy_in_user(compat_rxnfc, rxnfc,
- (const void *)(&rxnfc->fs.m_ext + 1) -
- (const void *)rxnfc) ||
+ (const void __user *)(&rxnfc->fs.m_ext + 1) -
+ (const void __user *)rxnfc) ||
copy_in_user(&compat_rxnfc->fs.ring_cookie,
&rxnfc->fs.ring_cookie,
- (const void *)(&rxnfc->fs.location + 1) -
- (const void *)&rxnfc->fs.ring_cookie) ||
+ (const void __user *)(&rxnfc->fs.location + 1) -
+ (const void __user *)&rxnfc->fs.ring_cookie) ||
copy_in_user(&compat_rxnfc->rule_cnt, &rxnfc->rule_cnt,
sizeof(rxnfc->rule_cnt)))
return -EFAULT;
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH net-next] ethtool: fix sparse warning
2013-02-11 16:22 [PATCH net-next] ethtool: fix sparse warning Stephen Hemminger
@ 2013-02-11 17:21 ` Ben Hutchings
2013-02-11 19:18 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: Ben Hutchings @ 2013-02-11 17:21 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: David Miller, netdev
On Mon, 2013-02-11 at 08:22 -0800, Stephen Hemminger wrote:
> Fixes sparse complaints about dropping __user in casts.
> warning: cast removes address space of expression
>
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Ben Hutchings <bhutchings@solarflare.com>
>
> --- a/net/socket.c 2013-02-11 08:17:45.081011548 -0800
> +++ b/net/socket.c 2013-02-11 08:19:52.743355382 -0800
> @@ -2837,7 +2837,7 @@ static int ethtool_ioctl(struct net *net
> }
>
> ifr = compat_alloc_user_space(buf_size);
> - rxnfc = (void *)ifr + ALIGN(sizeof(struct ifreq), 8);
> + rxnfc = (void __user *)ifr + ALIGN(sizeof(struct ifreq), 8);
>
> if (copy_in_user(&ifr->ifr_name, &ifr32->ifr_name, IFNAMSIZ))
> return -EFAULT;
> @@ -2861,12 +2861,12 @@ static int ethtool_ioctl(struct net *net
> offsetof(struct ethtool_rxnfc, fs.ring_cookie));
>
> if (copy_in_user(rxnfc, compat_rxnfc,
> - (void *)(&rxnfc->fs.m_ext + 1) -
> - (void *)rxnfc) ||
> + (void __user *)(&rxnfc->fs.m_ext + 1) -
> + (void __user *)rxnfc) ||
> copy_in_user(&rxnfc->fs.ring_cookie,
> &compat_rxnfc->fs.ring_cookie,
> - (void *)(&rxnfc->fs.location + 1) -
> - (void *)&rxnfc->fs.ring_cookie) ||
> + (void __user *)(&rxnfc->fs.location + 1) -
> + (void __user *)&rxnfc->fs.ring_cookie) ||
> copy_in_user(&rxnfc->rule_cnt, &compat_rxnfc->rule_cnt,
> sizeof(rxnfc->rule_cnt)))
> return -EFAULT;
> @@ -2878,12 +2878,12 @@ static int ethtool_ioctl(struct net *net
>
> if (convert_out) {
> if (copy_in_user(compat_rxnfc, rxnfc,
> - (const void *)(&rxnfc->fs.m_ext + 1) -
> - (const void *)rxnfc) ||
> + (const void __user *)(&rxnfc->fs.m_ext + 1) -
> + (const void __user *)rxnfc) ||
> copy_in_user(&compat_rxnfc->fs.ring_cookie,
> &rxnfc->fs.ring_cookie,
> - (const void *)(&rxnfc->fs.location + 1) -
> - (const void *)&rxnfc->fs.ring_cookie) ||
> + (const void __user *)(&rxnfc->fs.location + 1) -
> + (const void __user *)&rxnfc->fs.ring_cookie) ||
> copy_in_user(&compat_rxnfc->rule_cnt, &rxnfc->rule_cnt,
> sizeof(rxnfc->rule_cnt)))
> return -EFAULT;
--
Ben Hutchings, Staff Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH net-next] ethtool: fix sparse warning
2013-02-11 16:22 [PATCH net-next] ethtool: fix sparse warning Stephen Hemminger
2013-02-11 17:21 ` Ben Hutchings
@ 2013-02-11 19:18 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2013-02-11 19:18 UTC (permalink / raw)
To: stephen; +Cc: bhutchings, netdev
From: Stephen Hemminger <stephen@networkplumber.org>
Date: Mon, 11 Feb 2013 08:22:28 -0800
> Fixes sparse complaints about dropping __user in casts.
> warning: cast removes address space of expression
>
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Applied.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-02-11 19:18 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-02-11 16:22 [PATCH net-next] ethtool: fix sparse warning Stephen Hemminger
2013-02-11 17:21 ` Ben Hutchings
2013-02-11 19:18 ` 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).