From: Arnd Bergmann <arnd@arndb.de>
To: spereira@tusc.com.au
Cc: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>,
Andi Kleen <ak@muc.de>,
linux-kenel <linux-kernel@vger.kernel.org>,
netdev <netdev@vger.kernel.org>, SP <pereira.shaun@gmail.com>
Subject: Re: 32 bit (socket layer) ioctl emulation for 64 bit kernels
Date: Mon, 16 Jan 2006 10:39:23 +0100 [thread overview]
Message-ID: <200601161039.24333.arnd@arndb.de> (raw)
In-Reply-To: <1137391160.5588.32.camel@spereira05.tusc.com.au>
On Monday 16 January 2006 06:59, Shaun Pereira wrote:
>
> I was wondering if this the compat_sock_get_timestamp function is
> needed? If I were to remove the SIOCGSTAMP case from the
> compat_x25_ioctl function, then a SIOCGSTAMP ioctl system call would
> return -ENOIOCTLCMD which could then be handled by do_siocgstamp
> handler in the ioctl32_hash_table? (fs/compat_ioctl.c)
> In which case I could remove this patch from the rest of the series.
Yes, that would also work, as I already mentioned (or tried to)
in one of my earlier comments. I would prefer to have this patch
though, because in the long term, I think we should migrate more
stuff away from the hash table and having the function there
means that others can use it as well.
> + err = -EFAULT;
> + if(access_ok(VERIFTY_WRITE, ctv, sizeof(*ctv))) {
> + err = __put_user(sk->sk_stamp.tv_sec, &ctv->tv_sec);
> + err != __put_user(sk->sk_stamp.tv_usec, &ctv->tv_usec);
> + }
> + return err;
> +}
This copies the correct data down to user space now, but might result
in returning an invalid error code.
In the second line you now have 'err != __put_user(...);', which is
a comparison, not an assignment!
For readability, I would simply write that as:
ret = 0;
if (put_user(sk->sk_stamp.tv_sec, &ctv->tv_sec) |
put_user(sk->sk_stamp.tv_usec, &ctv->tv_usec))
err = -EFAULT;
You can also write it like your code, but with '|' instead of '!', but
that requires the additional knowledge that __put_user can only ever
return '0' or '-EFAULT' itself and that the bitwise or of those is
therefore also one of these two.
Arnd <><
prev parent reply other threads:[~2006-01-16 9:39 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-01-12 6:02 [PATCH 2/4 - 2.6.15]net: 32 bit (socket layer) ioctl emulation for 64 bit kernels Shaun Pereira
2006-01-12 19:24 ` Arnd Bergmann
2006-01-13 3:14 ` Shaun Pereira
2006-01-13 11:46 ` Arnd Bergmann
2006-01-16 5:59 ` Shaun Pereira
2006-01-16 6:41 ` YOSHIFUJI Hideaki / 吉藤英明
[not found] ` <200601161043.31742.arnd@arndb.de>
2006-01-16 23:11 ` [PATCH 1/4 - 2.6.15 ]net : " Shaun Pereira
2006-01-16 23:11 ` [PATCH 2/4 - 2.6.15]net: " Shaun Pereira
2006-01-16 23:12 ` [PATCH 3/4 -2.6.15]:x25: " Shaun Pereira
2006-01-17 0:15 ` Arnd Bergmann
2006-01-17 4:20 ` [PATCH 3/4 -2.6.15- RESEND]:x25: " Shaun Pereira
2006-01-18 6:56 ` Shaun Pereira
2006-01-19 0:57 ` Arnd Bergmann
2006-01-19 1:05 ` David S. Miller
2006-01-16 23:12 ` [PATCH 4/4]x25: " Shaun Pereira
2006-01-16 9:39 ` Arnd Bergmann [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200601161039.24333.arnd@arndb.de \
--to=arnd@arndb.de \
--cc=acme@ghostprotocols.net \
--cc=ak@muc.de \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pereira.shaun@gmail.com \
--cc=spereira@tusc.com.au \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.