Add __user to binder_version to correct sparse warning.
Reduce line size to fit to coding style.
Signed-off-by: Mathieu Maret <[email protected]>
---
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..3dca577 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;
--
1.8.3.2
Remove duplicate code
Signed-off-by: Mathieu Maret <[email protected]>
---
drivers/staging/android/binder.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/drivers/staging/android/binder.c b/drivers/staging/android/binder.c
index 3dca577..c29c3c7 100644
--- a/drivers/staging/android/binder.c
+++ b/drivers/staging/android/binder.c
@@ -2686,11 +2686,8 @@ static long binder_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
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.8.3.2
This is the first time you have sent it to the list, it's not a RESEND.
Patch looks ok.
regards,
dan carpenter
On Tue, Apr 15, 2014 at 12:03:06PM +0200, Mathieu Maret wrote:
> Remove duplicate code
>
The original code is simpler actually.
regards,
dan carpenter
Dan Carpenter wrote:
> This is the first time you have sent it to the list, it's not a RESEND.
>
The first one was only on the linux-kernel mailing list.
May be, that's why you did not get it.
As it was just before the 3.14 release, I was asked to resend latter.
Is it the expected meaning of the "RESEND" tag?
> Patch looks ok.
Cool
>
> regards,
> dan carpenter
>
Regards,
Mathieu
On Tue, Apr 15, 2014 at 02:04:50PM +0200, Mathieu Maret wrote:
> Dan Carpenter wrote:
> > This is the first time you have sent it to the list, it's not a RESEND.
> >
> The first one was only on the linux-kernel mailing list.
Oh. No one reads lkml. It's just for the google archive.
regards,
dan carpenter
On Tue, Apr 15, 2014 at 12:03:06PM +0200, Mathieu Maret wrote:
> Remove duplicate code
>
> Signed-off-by: Mathieu Maret <[email protected]>
> ---
> drivers/staging/android/binder.c | 7 ++-----
> 1 file changed, 2 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/staging/android/binder.c b/drivers/staging/android/binder.c
> index 3dca577..c29c3c7 100644
> --- a/drivers/staging/android/binder.c
> +++ b/drivers/staging/android/binder.c
> @@ -2686,11 +2686,8 @@ static long binder_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
> 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;
I agree with Dan, the original code was easier to read.
thanks,
greg k-h