From: Joe Perches <joe@perches.com>
To: Mathieu Maret <mathieu.maret@gmail.com>
Cc: linux-kernel@vger.kernel.org, arve@android.com,
gregkh@linuxfoundation.org
Subject: Re: [PATCH 1/2] staging: binder: add __user annotation in binder.c
Date: Mon, 24 Mar 2014 17:51:25 -0700 [thread overview]
Message-ID: <1395708685.31285.2.camel@joe-AO722> (raw)
In-Reply-To: <1395707065-23808-1-git-send-email-mathieu.maret@gmail.com>
On Tue, 2014-03-25 at 01:24 +0100, Mathieu Maret wrote:
> Fix the following spare warning
sparse
> drivers/staging/android/binder.c:2691:21: warning: incorrect type in argument 1 (different address spaces)
[]
> diff --git a/drivers/staging/android/binder.c b/drivers/staging/android/binder.c
[]
> @@ -2688,7 +2688,7 @@ static long binder_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
[]
> - if (put_user(BINDER_CURRENT_PROTOCOL_VERSION, &((struct binder_version *)ubuf)->protocol_version)) {
> + if (put_user(BINDER_CURRENT_PROTOCOL_VERSION, &((struct binder_version __user *)ubuf)->protocol_version)) {
That's certainly one way to do it, but I'd suggest
using a temporary instead
drivers/staging/android/binder.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/drivers/staging/android/binder.c b/drivers/staging/android/binder.c
index cfe4bc8..1f5e249 100644
--- a/drivers/staging/android/binder.c
+++ b/drivers/staging/android/binder.c
@@ -2683,16 +2683,20 @@ static long binder_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
binder_free_thread(proc, thread);
thread = NULL;
break;
- case BINDER_VERSION:
+ case BINDER_VERSION: {
+ struct binder_version __user *ver = ubuf;
+
if (size != sizeof(struct binder_version)) {
ret = -EINVAL;
goto err;
}
- if (put_user(BINDER_CURRENT_PROTOCOL_VERSION, &((struct binder_version *)ubuf)->protocol_version)) {
+ if (put_user(BINDER_CURRENT_PROTOCOL_VERSION,
+ &ver->protocol_version)) {
ret = -EINVAL;
goto err;
}
break;
+ }
default:
ret = -EINVAL;
goto err;
next prev parent reply other threads:[~2014-03-25 0:51 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-25 0:24 Mathieu Maret
2014-03-25 0:24 ` [PATCH 2/2] staging: binder: reduce line size Mathieu Maret
2014-03-25 0:51 ` Joe Perches [this message]
2014-03-25 0:54 ` [PATCH 1/2] staging: binder: add __user annotation in binder.c Mathieu Maret
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=1395708685.31285.2.camel@joe-AO722 \
--to=joe@perches.com \
--cc=arve@android.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mathieu.maret@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®