ethtool: fix sparse warning
Subsystems (3)
PATCH 1/1 ethtool: fix sparse warning
Fixes sparse complaints about dropping __user in casts.
warning: cast removes address space of expression
Signed-off-by Stephen Hemminger <[email protected]>
net/socket.c +9 -9
@@ -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 *netif (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 ;
Quoted 4 lines · Stephen Hemminger
Fixes sparse complaints about dropping
__userin casts.
warning: cast removes address space of expressionSigned-off-by Stephen Hemminger <[email protected]>
Acked-by Ben Hutchings <[email protected]>
Quoted 46 lines
net/socket.c +9
-9@@ -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 *netif (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 ;
Signature · 3 lines
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.
From: Stephen Hemminger <[email protected]>
Date: Mon, 11 Feb 2013 08:22:28 -0800
Quoted 4 lines
Fixes sparse complaints about dropping
__userin casts.
warning: cast removes address space of expressionSigned-off-by Stephen Hemminger <[email protected]>
Applied.