* [PATCHv2 1/2] staging: binder: add __user annotation in binder.c
@ 2014-03-25 22:03 Mathieu Maret
2014-03-25 22:03 ` [PATCH 2/2] staging: binder: Code simplification Mathieu Maret
0 siblings, 1 reply; 4+ messages in thread
From: Mathieu Maret @ 2014-03-25 22:03 UTC (permalink / raw)
To: linux-kernel; +Cc: arve, gregkh, joe, Mathieu Maret
Add __user to binder_version and correct sparse warning.
Reduce line size to fit to coding style.
Signed-off-by: Mathieu Maret <mathieu.maret@gmail.com>
---
drivers/staging/android/binder.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/drivers/staging/android/binder.c b/drivers/staging/android/binder.c
index cfe4bc8..6d8ee37 100644
--- a/drivers/staging/android/binder.c
+++ b/drivers/staging/android/binder.c
@@ -2683,16 +2683,19 @@ 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;
--
1.9.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/2] staging: binder: Code simplification
2014-03-25 22:03 [PATCHv2 1/2] staging: binder: add __user annotation in binder.c Mathieu Maret
@ 2014-03-25 22:03 ` Mathieu Maret
2014-03-25 22:21 ` Joe Perches
0 siblings, 1 reply; 4+ messages in thread
From: Mathieu Maret @ 2014-03-25 22:03 UTC (permalink / raw)
To: linux-kernel; +Cc: arve, gregkh, joe, Mathieu Maret
Remove duplicate code
Signed-off-by: Mathieu Maret <mathieu.maret@gmail.com>
---
drivers/staging/android/binder.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/drivers/staging/android/binder.c b/drivers/staging/android/binder.c
index 6d8ee37..67aaa38 100644
--- a/drivers/staging/android/binder.c
+++ b/drivers/staging/android/binder.c
@@ -2685,11 +2685,9 @@ static long binder_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
break;
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,
+
+ if (size != sizeof(struct binder_version) ||
+ put_user(BINDER_CURRENT_PROTOCOL_VERSION,
&ver->protocol_version)) {
ret = -EINVAL;
goto err;
--
1.9.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 2/2] staging: binder: Code simplification
2014-03-25 22:03 ` [PATCH 2/2] staging: binder: Code simplification Mathieu Maret
@ 2014-03-25 22:21 ` Joe Perches
2014-03-25 22:47 ` Mathieu Maret
0 siblings, 1 reply; 4+ messages in thread
From: Joe Perches @ 2014-03-25 22:21 UTC (permalink / raw)
To: Mathieu Maret; +Cc: linux-kernel, arve, gregkh
On Tue, 2014-03-25 at 23:03 +0100, Mathieu Maret wrote:
> Remove duplicate code
[]
> diff --git a/drivers/staging/android/binder.c b/drivers/staging/android/binder.c
[]
> @@ -2685,11 +2685,9 @@ static long binder_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
> break;
> 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,
> +
> + if (size != sizeof(struct binder_version) ||
> + put_user(BINDER_CURRENT_PROTOCOL_VERSION,
> &ver->protocol_version)) {
When you do this, please align continuations at the appropriate
open parenthesis using maximal initial tabs and minimal spaces
for alignment.
if (size != sizeof(struct binder_version) ||
put_user(BINDER_CURRENT_PROTOCOL_VERSION,
&ver->protocol_version)) {
2 tabs then 4 spaces then "put_user"
3 tabs then 5 spaces then "&ver->"
using scripts/checkpatch.pl --strict should alert you to this.
And, either don't submit this until after 3.15-rc1 is out
and Greg KH starts taking patches again, or expect to be
very patient about getting any update on this.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 2/2] staging: binder: Code simplification
2014-03-25 22:21 ` Joe Perches
@ 2014-03-25 22:47 ` Mathieu Maret
0 siblings, 0 replies; 4+ messages in thread
From: Mathieu Maret @ 2014-03-25 22:47 UTC (permalink / raw)
To: Joe Perches; +Cc: linux-kernel, arve, gregkh
Joe Perches wrote:
> On Tue, 2014-03-25 at 23:03 +0100, Mathieu Maret wrote:
> > Remove duplicate code
> []
> > diff --git a/drivers/staging/android/binder.c b/drivers/staging/android/binder.c
> []
> > @@ -2685,11 +2685,9 @@ static long binder_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
> > break;
> > 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,
> > +
> > + if (size != sizeof(struct binder_version) ||
> > + put_user(BINDER_CURRENT_PROTOCOL_VERSION,
> > &ver->protocol_version)) {
>
> When you do this, please align continuations at the appropriate
> open parenthesis using maximal initial tabs and minimal spaces
> for alignment.
>
> if (size != sizeof(struct binder_version) ||
> put_user(BINDER_CURRENT_PROTOCOL_VERSION,
> &ver->protocol_version)) {
>
> 2 tabs then 4 spaces then "put_user"
> 3 tabs then 5 spaces then "&ver->"
>
> using scripts/checkpatch.pl --strict should alert you to this.
>
> And, either don't submit this until after 3.15-rc1 is out
> and Greg KH starts taking patches again, or expect to be
> very patient about getting any update on this.
>
Joe,
Thanks for your help and tips.
--strict is now on my todo list !
See you after 3.15-rc1
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2014-03-25 22:47 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-25 22:03 [PATCHv2 1/2] staging: binder: add __user annotation in binder.c Mathieu Maret
2014-03-25 22:03 ` [PATCH 2/2] staging: binder: Code simplification Mathieu Maret
2014-03-25 22:21 ` Joe Perches
2014-03-25 22:47 ` Mathieu Maret
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox