* [PATCH] netdev: get rid of casts
@ 2007-04-24 17:46 Stephen Hemminger
2007-04-24 18:07 ` Jeff Garzik
0 siblings, 1 reply; 4+ messages in thread
From: Stephen Hemminger @ 2007-04-24 17:46 UTC (permalink / raw)
To: David Miller; +Cc: netdev
The following casts are unnecessary, just passing void * will do.
Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org>
---
net/core/dev.c | 10 +++++-----
1 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/net/core/dev.c b/net/core/dev.c
index 18c51b4..61e9da2 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -1981,7 +1981,7 @@ int register_gifconf(unsigned int family, gifconf_func_t * gifconf)
* match. --pb
*/
-static int dev_ifname(struct ifreq __user *arg)
+static int dev_ifname(void __user *arg)
{
struct net_device *dev;
struct ifreq ifr;
@@ -2014,7 +2014,7 @@ static int dev_ifname(struct ifreq __user *arg)
* Thus we will need a 'compatibility mode'.
*/
-static int dev_ifconf(char __user *arg)
+static int dev_ifconf(void __user *arg)
{
struct ifconf ifc;
struct net_device *dev;
@@ -2778,12 +2778,12 @@ int dev_ioctl(unsigned int cmd, void __user *arg)
if (cmd == SIOCGIFCONF) {
rtnl_lock();
- ret = dev_ifconf((char __user *) arg);
+ ret = dev_ifconf(arg);
rtnl_unlock();
- return ret;
}
+
if (cmd == SIOCGIFNAME)
- return dev_ifname((struct ifreq __user *)arg);
+ return dev_ifname(arg);
if (copy_from_user(&ifr, arg, sizeof(struct ifreq)))
return -EFAULT;
--
1.5.0.6
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] netdev: get rid of casts
2007-04-24 17:46 [PATCH] netdev: get rid of casts Stephen Hemminger
@ 2007-04-24 18:07 ` Jeff Garzik
2007-04-24 21:53 ` David Miller
2007-04-25 0:56 ` Herbert Xu
0 siblings, 2 replies; 4+ messages in thread
From: Jeff Garzik @ 2007-04-24 18:07 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: David Miller, netdev
Stephen Hemminger wrote:
> The following casts are unnecessary, just passing void * will do.
>
> Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org>
> ---
> net/core/dev.c | 10 +++++-----
> 1 files changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/net/core/dev.c b/net/core/dev.c
> index 18c51b4..61e9da2 100644
> --- a/net/core/dev.c
> +++ b/net/core/dev.c
> @@ -1981,7 +1981,7 @@ int register_gifconf(unsigned int family, gifconf_func_t * gifconf)
> * match. --pb
> */
>
> -static int dev_ifname(struct ifreq __user *arg)
> +static int dev_ifname(void __user *arg)
> {
> struct net_device *dev;
> struct ifreq ifr;
> @@ -2014,7 +2014,7 @@ static int dev_ifname(struct ifreq __user *arg)
> * Thus we will need a 'compatibility mode'.
> */
>
> -static int dev_ifconf(char __user *arg)
> +static int dev_ifconf(void __user *arg)
> {
> struct ifconf ifc;
> struct net_device *dev;
> @@ -2778,12 +2778,12 @@ int dev_ioctl(unsigned int cmd, void __user *arg)
>
> if (cmd == SIOCGIFCONF) {
> rtnl_lock();
> - ret = dev_ifconf((char __user *) arg);
> + ret = dev_ifconf(arg);
> rtnl_unlock();
> - return ret;
> }
> +
> if (cmd == SIOCGIFNAME)
> - return dev_ifname((struct ifreq __user *)arg);
> + return dev_ifname(arg);
Seems like a net loss of information, with your patch.
The casts are adding missing type information, in this case. Certainly
it is more for human consumption than compiler consumption, but
nonetheless...
Jeff
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] netdev: get rid of casts
2007-04-24 18:07 ` Jeff Garzik
@ 2007-04-24 21:53 ` David Miller
2007-04-25 0:56 ` Herbert Xu
1 sibling, 0 replies; 4+ messages in thread
From: David Miller @ 2007-04-24 21:53 UTC (permalink / raw)
To: jeff; +Cc: shemminger, netdev
From: Jeff Garzik <jeff@garzik.org>
Date: Tue, 24 Apr 2007 14:07:32 -0400
> Stephen Hemminger wrote:
> > The following casts are unnecessary, just passing void * will do.
> >
> > Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org>
> > ---
> > net/core/dev.c | 10 +++++-----
> > 1 files changed, 5 insertions(+), 5 deletions(-)
> >
> > diff --git a/net/core/dev.c b/net/core/dev.c
> > index 18c51b4..61e9da2 100644
> > --- a/net/core/dev.c
> > +++ b/net/core/dev.c
> > @@ -1981,7 +1981,7 @@ int register_gifconf(unsigned int family, gifconf_func_t * gifconf)
> > * match. --pb
> > */
> >
> > -static int dev_ifname(struct ifreq __user *arg)
> > +static int dev_ifname(void __user *arg)
> > {
> > struct net_device *dev;
> > struct ifreq ifr;
> > @@ -2014,7 +2014,7 @@ static int dev_ifname(struct ifreq __user *arg)
> > * Thus we will need a 'compatibility mode'.
> > */
> >
> > -static int dev_ifconf(char __user *arg)
> > +static int dev_ifconf(void __user *arg)
> > {
> > struct ifconf ifc;
> > struct net_device *dev;
> > @@ -2778,12 +2778,12 @@ int dev_ioctl(unsigned int cmd, void __user *arg)
> >
> > if (cmd == SIOCGIFCONF) {
> > rtnl_lock();
> > - ret = dev_ifconf((char __user *) arg);
> > + ret = dev_ifconf(arg);
> > rtnl_unlock();
> > - return ret;
> > }
> > +
> > if (cmd == SIOCGIFNAME)
> > - return dev_ifname((struct ifreq __user *)arg);
> > + return dev_ifname(arg);
>
> Seems like a net loss of information, with your patch.
>
> The casts are adding missing type information, in this case. Certainly
> it is more for human consumption than compiler consumption, but
> nonetheless...
I agree, I think I'll drop this one therefore.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] netdev: get rid of casts
2007-04-24 18:07 ` Jeff Garzik
2007-04-24 21:53 ` David Miller
@ 2007-04-25 0:56 ` Herbert Xu
1 sibling, 0 replies; 4+ messages in thread
From: Herbert Xu @ 2007-04-25 0:56 UTC (permalink / raw)
To: Jeff Garzik; +Cc: shemminger, davem, netdev
Jeff Garzik <jeff@garzik.org> wrote:
>
>> @@ -2778,12 +2778,12 @@ int dev_ioctl(unsigned int cmd, void __user *arg)
>>
>> if (cmd == SIOCGIFCONF) {
>> rtnl_lock();
>> - ret = dev_ifconf((char __user *) arg);
>> + ret = dev_ifconf(arg);
>> rtnl_unlock();
>> - return ret;
>> }
>> +
>> if (cmd == SIOCGIFNAME)
>> - return dev_ifname((struct ifreq __user *)arg);
>> + return dev_ifname(arg);
>
> Seems like a net loss of information, with your patch.
>
> The casts are adding missing type information, in this case. Certainly
> it is more for human consumption than compiler consumption, but
> nonetheless...
How about just getting rid of the casts? 'arg' is already void * to
begin with.
Cheers,
--
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2007-04-25 0:56 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-04-24 17:46 [PATCH] netdev: get rid of casts Stephen Hemminger
2007-04-24 18:07 ` Jeff Garzik
2007-04-24 21:53 ` David Miller
2007-04-25 0:56 ` Herbert Xu
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).