staging: binder: add __user annotation in binder.c
PATCH 1/2 staging: binder: add __user annotation in binder.c
Fix the following spare warningdrivers/staging/android/binder.c:2691:21: warning: incorrect type in argument 1 (different address spaces)
--- drivers/staging/android/binder.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/android/binder.c +1 -1
@@ -2688,7 +2688,7 @@ static long binder_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) ret = -EINVAL ; goto err; } -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)) { ret = -EINVAL ; goto err; }
Signature · 1 line
1.9.1
PATCH 2/2 staging: binder: reduce line size
--- drivers/staging/android/binder.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/staging/android/binder.c +2 -1
@@ -2688,7 +2688,8 @@ static long binder_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) ret = -EINVAL ; goto err; } -if (put_user (BINDER_CURRENT_PROTOCOL_VERSION , &((struct binder_version __user *)ubuf)->protocol_version)) { +if (put_user (BINDER_CURRENT_PROTOCOL_VERSION , + &((struct binder_version __user *)ubuf)->protocol_version)) { ret = -EINVAL ; goto err; }
Signature · 1 line
1.9.1
Quoted 1 line · Mathieu Maret
Fix the following spare warning
sparse
Quoted 1 line
drivers/staging/android/binder.c:2691:21: warning: incorrect type in argument 1 (different address spaces)
[]
drivers/staging/android/binder.c
Quoted 1 line
drivers/staging/android/binder.c +0
-0
[]
drivers/staging/android/binder.c static long binder_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
Quoted 1 line
drivers/staging/android/binder.c +0
-0@@ -2688,7 +2688,7 @@ static long binder_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
[]
drivers/staging/android/binder.c static long binder_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) · line 2688
Quoted 2 lines
drivers/staging/android/binder.c +1
-1-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(-)
drivers/staging/android/binder.c +6 -2
@@ -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;
Quoted 39 lines · Joe Perches
Quoted 1 line · Mathieu Maret
Fix the following spare warning
sparse
Quoted 1 line
drivers/staging/android/binder.c:2691:21: warning: incorrect type in argument 1 (different address spaces)[]
drivers/staging/android/binder.c
Quoted 1 line
drivers/staging/android/binder.c +0
-0[]
drivers/staging/android/binder.c static long binder_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
Quoted 1 line
drivers/staging/android/binder.c +0
-0@@ -2688,7 +2688,7 @@ static long binder_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)[]
drivers/staging/android/binder.c static long binder_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) · line 2688
Quoted 2 lines
drivers/staging/android/binder.c +1
-1-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(-)drivers/staging/android/binder.c +3
-2@@ -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)) {
drivers/staging/android/binder.c static long binder_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) · line 2702
Quoted 10 lines
drivers/staging/android/binder.c +3
-0+if (put_user (BINDER_CURRENT_PROTOCOL_VERSION , + &ver->protocol_version)) { ret = -EINVAL ; goto err; }break ; + }default : ret = -EINVAL ; goto err;
And you solve the issue with the line size btw.
Good move!