From: Arnd Bergmann <arnd@arndb.de>
To: Mark Salter <msalter@redhat.com>
Cc: linux-arch@vger.kernel.org
Subject: Re: [PATCH] fix generic get_user and put_user
Date: Tue, 17 May 2011 22:26:53 +0200 [thread overview]
Message-ID: <201105172226.54517.arnd@arndb.de> (raw)
In-Reply-To: <1305657349-2783-1-git-send-email-msalter@redhat.com>
On Tuesday 17 May 2011, Mark Salter wrote:
> diff --git a/include/asm-generic/uaccess.h b/include/asm-generic/uaccess.h
> index 1d0fdf8..5079335 100644
> --- a/include/asm-generic/uaccess.h
> +++ b/include/asm-generic/uaccess.h
> @@ -162,9 +162,10 @@ static inline __must_check long __copy_to_user(void __user *to,
>
> #define put_user(x, ptr) \
> ({ \
> + __typeof__(*(ptr)) *__pu_ptr = (ptr); \
> might_sleep(); \
> - access_ok(VERIFY_WRITE, ptr, sizeof(*ptr)) ? \
> - __put_user(x, ptr) : \
> + access_ok(VERIFY_WRITE, __pu_ptr, sizeof(*ptr)) ? \
> + __put_user(x, __pu_ptr) : \
> -EFAULT; \
> })
>
> @@ -218,9 +219,10 @@ extern int __put_user_bad(void) __attribute__((noreturn));
>
> #define get_user(x, ptr) \
> ({ \
> + __typeof__(*(ptr)) *__gu_ptr = (ptr); \
> might_sleep(); \
> - access_ok(VERIFY_READ, ptr, sizeof(*ptr)) ? \
> - __get_user(x, ptr) : \
> + access_ok(VERIFY_READ, __gu_ptr, sizeof(*ptr)) ? \
> + __get_user(x, __gu_ptr) : \
> -EFAULT; \
> })
>
IIRC, this doesn't work for get_user if the pointer is marked const.
Do you see a real problem with the current definitions, or are you
just trying to improve them genrally?
Arnd
next prev parent reply other threads:[~2011-05-17 20:26 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-17 18:35 [PATCH] fix generic get_user and put_user Mark Salter
2011-05-17 20:26 ` Arnd Bergmann [this message]
2011-05-17 21:25 ` Mark Salter
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=201105172226.54517.arnd@arndb.de \
--to=arnd@arndb.de \
--cc=linux-arch@vger.kernel.org \
--cc=msalter@redhat.com \
/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.