All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH RESEND 1/2] staging: binder: add __user annotation in binder.c
@ 2014-04-15 10:03 Mathieu Maret
  2014-04-15 10:03 ` [PATCH RESEND 2/2] staging: binder: Code simplification Mathieu Maret
  2014-04-15 11:54 ` [PATCH RESEND 1/2] staging: binder: add __user annotation in binder.c Dan Carpenter
  0 siblings, 2 replies; 7+ messages in thread
From: Mathieu Maret @ 2014-04-15 10:03 UTC (permalink / raw)
  Cc: linux-kernel, gregkh, arve, joe, serban.constantinescu, prtvar.b,
	devel, standby24x7, Mathieu Maret

Add __user to binder_version to 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 | 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


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH RESEND 2/2] staging: binder: Code simplification
  2014-04-15 10:03 [PATCH RESEND 1/2] staging: binder: add __user annotation in binder.c Mathieu Maret
@ 2014-04-15 10:03 ` Mathieu Maret
  2014-04-15 11:56   ` Dan Carpenter
  2014-04-17  3:16   ` Greg KH
  2014-04-15 11:54 ` [PATCH RESEND 1/2] staging: binder: add __user annotation in binder.c Dan Carpenter
  1 sibling, 2 replies; 7+ messages in thread
From: Mathieu Maret @ 2014-04-15 10:03 UTC (permalink / raw)
  Cc: linux-kernel, gregkh, arve, joe, serban.constantinescu, prtvar.b,
	devel, standby24x7, Mathieu Maret

Remove duplicate code

Signed-off-by: Mathieu Maret <mathieu.maret@gmail.com>
---
 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


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH RESEND 1/2] staging: binder: add __user annotation in binder.c
  2014-04-15 10:03 [PATCH RESEND 1/2] staging: binder: add __user annotation in binder.c Mathieu Maret
  2014-04-15 10:03 ` [PATCH RESEND 2/2] staging: binder: Code simplification Mathieu Maret
@ 2014-04-15 11:54 ` Dan Carpenter
  2014-04-15 12:04   ` Mathieu Maret
  1 sibling, 1 reply; 7+ messages in thread
From: Dan Carpenter @ 2014-04-15 11:54 UTC (permalink / raw)
  To: Mathieu Maret
  Cc: devel, gregkh, serban.constantinescu, linux-kernel, arve, joe, prtvar.b

This is the first time you have sent it to the list, it's not a RESEND.

Patch looks ok.

regards,
dan carpenter


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH RESEND 2/2] staging: binder: Code simplification
  2014-04-15 10:03 ` [PATCH RESEND 2/2] staging: binder: Code simplification Mathieu Maret
@ 2014-04-15 11:56   ` Dan Carpenter
  2014-04-17  3:16   ` Greg KH
  1 sibling, 0 replies; 7+ messages in thread
From: Dan Carpenter @ 2014-04-15 11:56 UTC (permalink / raw)
  To: Mathieu Maret
  Cc: devel, gregkh, serban.constantinescu, linux-kernel, arve, joe, prtvar.b

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


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH RESEND 1/2] staging: binder: add __user annotation in binder.c
  2014-04-15 11:54 ` [PATCH RESEND 1/2] staging: binder: add __user annotation in binder.c Dan Carpenter
@ 2014-04-15 12:04   ` Mathieu Maret
  2014-04-15 12:44     ` Dan Carpenter
  0 siblings, 1 reply; 7+ messages in thread
From: Mathieu Maret @ 2014-04-15 12:04 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: devel, gregkh, serban.constantinescu, linux-kernel, arve, joe, prtvar.b

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH RESEND 1/2] staging: binder: add __user annotation in binder.c
  2014-04-15 12:04   ` Mathieu Maret
@ 2014-04-15 12:44     ` Dan Carpenter
  0 siblings, 0 replies; 7+ messages in thread
From: Dan Carpenter @ 2014-04-15 12:44 UTC (permalink / raw)
  To: Mathieu Maret
  Cc: devel, gregkh, serban.constantinescu, linux-kernel, arve, joe, prtvar.b

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


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH RESEND 2/2] staging: binder: Code simplification
  2014-04-15 10:03 ` [PATCH RESEND 2/2] staging: binder: Code simplification Mathieu Maret
  2014-04-15 11:56   ` Dan Carpenter
@ 2014-04-17  3:16   ` Greg KH
  1 sibling, 0 replies; 7+ messages in thread
From: Greg KH @ 2014-04-17  3:16 UTC (permalink / raw)
  To: Mathieu Maret
  Cc: devel, serban.constantinescu, linux-kernel, arve, joe, prtvar.b

On Tue, Apr 15, 2014 at 12:03:06PM +0200, Mathieu Maret wrote:
> Remove duplicate code
> 
> Signed-off-by: Mathieu Maret <mathieu.maret@gmail.com>
> ---
>  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

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2014-04-17  3:16 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-15 10:03 [PATCH RESEND 1/2] staging: binder: add __user annotation in binder.c Mathieu Maret
2014-04-15 10:03 ` [PATCH RESEND 2/2] staging: binder: Code simplification Mathieu Maret
2014-04-15 11:56   ` Dan Carpenter
2014-04-17  3:16   ` Greg KH
2014-04-15 11:54 ` [PATCH RESEND 1/2] staging: binder: add __user annotation in binder.c Dan Carpenter
2014-04-15 12:04   ` Mathieu Maret
2014-04-15 12:44     ` Dan Carpenter

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.