Skip to contentSkip to conversation

staging: android: binder: fix some sparse warnings and long lines

PATCH Superseded Emil Goode 3 participants 9 messages Apr 23, 2012

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Emil Goode

author
#0 lore raw

PATCH 1/1 staging: android: binder: fix some sparse warnings and long lines

This patch silences some sparse warnings and adds some line breaks to take the 80 char limit coding style rule in consideration.

---
 drivers/staging/android/binder.c |   14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)
drivers/staging/android/binder.c +10 -4
index c283212..5d31417 100644
@@ -1600,15 +1600,21 @@ static void binder_transaction(struct binder_proc *proc,
 		case BINDER_TYPE_BINDER:
 		case BINDER_TYPE_WEAK_BINDER: {
 			struct binder_ref *ref;
-			struct binder_node *node = binder_get_node(proc, fp->binder);
+			struct binder_node *node = binder_get_node(proc, 
+						     (void __user *)fp->binder);
 			if (node = NULL) {
-				node = binder_new_node(proc, fp->binder, fp->cookie);
+				node = binder_new_node(proc, 
+						(void __user *)fp->binder, 
+						(void __user *)fp->cookie);
 				if (node = NULL) {
 					return_error = BR_FAILED_REPLY;
 					goto err_binder_new_node_failed;
 				}
-				node->min_priority = fp->flags & FLAT_BINDER_FLAG_PRIORITY_MASK;
-				node->accept_fds = !!(fp->flags & FLAT_BINDER_FLAG_ACCEPTS_FDS);
+				node->min_priority = fp->flags & 
+						FLAT_BINDER_FLAG_PRIORITY_MASK;
+				
+				node->accept_fds = !!(fp->flags & 
+						FLAT_BINDER_FLAG_ACCEPTS_FDS);
 			}
 			if (fp->cookie != node->cookie) {
 				binder_user_error("binder: %d:%d sending u%p "
Signature · 1 line
1.7.9.5
#1 lore raw

Resend in plain text, sorry...

Quoted 76 lines

Em 23 de abril de 2012 14:23, Emil Goode <[email protected]> escreveu:

Quoted 4 lines

This patch silences some sparse warnings and adds some line breaks to take the 80 char limit coding style rule in consideration.

Nice work Emil!

What do you think to put the sparse warnings in the commit message?

I think it is better to understandа what are you trying to fix.

Quoted 50 lines

---
аdrivers/staging/android/binder.c | а 14 ++++++++++---- а1 file changed, 10 insertions(+), 4 deletions(-)

drivers/staging/android/binder.c +0 -0
index c283212..5d31417 100644
@@ -1600,15 +1600,21 @@ static void binder_transaction(struct binder_proc
 *proc,

а а а а а а а аcase BINDER_TYPE_BINDER:
а а а а а а а аcase BINDER_TYPE_WEAK_BINDER: {
а а а а а а а а а а а аstruct binder_ref *ref;
- а а а а а а а а а а а struct binder_node *node = binder_get_node(proc, fp->binder);
+ а а а а а а а а а а а struct binder_node *node = binder_get_node(proc,
+ а а а а а а а а а а а а а а а а а а а а а а а а а а(void __user *)fp->binder);
а а а а а а а а а а а аif (node = NULL) {
- а а а а а а а а а а а а а а а node = binder_new_node(proc, fp->binder, fp->cookie);
+ а а а а а а а а а а а а а а а node = binder_new_node(proc,
+ а а а а а а а а а а а а а а а а а а а а а а а (void __user *)fp->binder,
+ а а а а а а а а а а а а а а а а а а а а а а а (void __user *)fp->cookie);
а а а а а а а а а а а а а а а аif (node = NULL) {
а а а а а а а а а а а а а а а а а а а аreturn_error = BR_FAILED_REPLY; а а а а а а а а а а а а а а а а а а а аgoto err_binder_new_node_failed; а а а а а а а а а а а а а а а а}
- а а а а а а а а а а а а а а а node->min_priority = fp->flags & FLAT_BINDER_FLAG_PRIORITY_MASK;
- а а а а а а а а а а а а а а а node->accept_fds = !!(fp->flags & FLAT_BINDER_FLAG_ACCEPTS_FDS);
+ а а а а а а а а а а а а а а а node->min_priority = fp->flags & +
FLAT_BINDER_FLAG_PRIORITY_MASK;

drivers/staging/android/binder.c +3 -0
+
+ а а а а а а а а а а а а а а а node->accept_fds = !!(fp->flags &
+

FLAT_BINDER_FLAG_ACCEPTS_FDS);
а а а а а а а а а а а а}
а а а а а а а а а а а аif (fp->cookie != node->cookie) {
а а а а а а а а а а а а а а а аbinder_user_error("binder: %d:%d sending u%p "
--
1.7.9.5

Quoted 5 lines

--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to [email protected]
More majordomo info at аhttp://vger.kernel.org/majordomo-info.html

--
Att,

Quoted 4 lines

Marcos Paulo de Souza
Acadъmico de Ciencia da Computaчуo - FURB - SC "Uma vida sem desafios щ uma vida sem razуo" "A life without challenges, is a non reason life"

--
Att,

Marcos Paulo de Souza
Acadъmico de Ciencia da Computaчуo - FURB - SC
"Uma vida sem desafios щ uma vida sem razуo"
"A life without challenges, is a non reason life"
--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#2 lore raw
In reply to Emil Goode
Quoted 3 lines · Emil Goode

This patch silences some sparse warnings and adds some line breaks to take the 80 char limit coding style rule in consideration.

Don't mix long line changes and sparse changes.

You missed some fp->binder casts so there are still Sparse warnings. Anyway, these sparse annotations should probably go into the struct binder_node definition in the .h file instead of always casting. (I haven't verified. So be careful).

Don't forget to get to run your patches through checkpatch.pl before sending them. (There are whitespace problems in your patch).

regards,
dan carpenter

#3 lore raw
In reply to Emil Goode
Quoted 2 lines · Marcos Souza

Resend in plain text, sorry...

Content-Transfer-Encoding: 8bit
Content-Type: text/plain; charset=utf-8

I thought this was Ok. What's the problem with it?

regards,
dan carpenter

#4 lore raw
In reply to Emil Goode

Em 23 de abril de 2012 14:58, Dan Carpenter <[email protected]> escreveu:

Quoted 8 lines · Marcos Souza
Quoted 2 lines

Resend in plain text, sorry...

Content-Transfer-Encoding: 8bit
Content-Type: text/plain; charset=utf-8

I thought this was Ok.  What's the problem with it?

In my last attempt, [email protected] reject my e-mail, so I sent it in plain text.

Quoted 3 lines

regards,
dan carpenter

Signature · 10 lines
Att,

Marcos Paulo de Souza
Acadêmico de Ciencia da Computação - FURB - SC
"Uma vida sem desafios é uma vida sem razão"
"A life without challenges, is a non reason life"
--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
author
#5 lore raw
In reply to Emil Goode

Hello Marcos,

Sorry, here are the sparse warnings that the patch fixes:

drivers/staging/android/binder.c:1603:76: warning: incorrect type in argument 2 (different address spaces)
drivers/staging/android/binder.c:1603:76: expected void [noderef]
<asn:1>*ptr
drivers/staging/android/binder.c:1603:76: got void *binder
drivers/staging/android/binder.c:1605:64: warning: incorrect type in argument 2 (different address spaces)
drivers/staging/android/binder.c:1605:64: expected void [noderef]
<asn:1>*ptr
drivers/staging/android/binder.c:1605:64: got void *binder
drivers/staging/android/binder.c:1605:76: warning: incorrect type in argument 3 (different address spaces)
drivers/staging/android/binder.c:1605:76: expected void [noderef]
<asn:1>*cookie
drivers/staging/android/binder.c:1605:76: got void *cookie

Quoted 93 lines · Marcos Souza

Resend in plain text, sorry...

Quoted 76 lines

Em 23 de abril de 2012 14:23, Emil Goode <[email protected]> escreveu:

Quoted 4 lines

This patch silences some sparse warnings and adds some line breaks to take the 80 char limit coding style rule in consideration.

Nice work Emil!

What do you think to put the sparse warnings in the commit message?

I think it is better to understand what are you trying to fix.

Quoted 50 lines
---
 drivers/staging/android/binder.c |   14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)
drivers/staging/android/binder.c +5 -3
index c283212..5d31417 100644
@@ -1600,15 +1600,21 @@ static void binder_transaction(struct binder_proc
 *proc,
               case BINDER_TYPE_BINDER:
               case BINDER_TYPE_WEAK_BINDER: {
                       struct binder_ref *ref;
-                       struct binder_node *node = binder_get_node(proc,
 fp->binder);
+                       struct binder_node *node = binder_get_node(proc,
+                                                    (void __user
 *)fp->binder);
                       if (node = NULL) {
-                               node = binder_new_node(proc, fp->binder,
 fp->cookie);
+                               node = binder_new_node(proc,
+                                               (void __user
 *)fp->binder,
+                                               (void __user
 *)fp->cookie);
                               if (node = NULL) {
                                       return_error = BR_FAILED_REPLY;
                                       goto err_binder_new_node_failed;
                               }
-                               node->min_priority = fp->flags &

FLAT_BINDER_FLAG_PRIORITY_MASK;
- node->accept_fds = !!(fp->flags &
FLAT_BINDER_FLAG_ACCEPTS_FDS);

drivers/staging/android/binder.c +2 -0
+                               node->min_priority = fp->flags &
+

FLAT_BINDER_FLAG_PRIORITY_MASK;

drivers/staging/android/binder.c +3 -0
+
+                               node->accept_fds = !!(fp->flags &
+
FLAT_BINDER_FLAG_ACCEPTS_FDS);
                       }
                       if (fp->cookie != node->cookie) {
                               binder_user_error("binder: %d:%d sending

u%p "
--
1.7.9.5

Quoted 5 lines

--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

--
Att,

Quoted 4 lines

Marcos Paulo de Souza
Acadêmico de Ciencia da Computação - FURB - SC "Uma vida sem desafios é uma vida sem razão" "A life without challenges, is a non reason life"

--
Att,

Marcos Paulo de Souza
Acadêmico de Ciencia da Computação - FURB - SC "Uma vida sem desafios é uma vida sem razão" "A life without challenges, is a non reason life"

author
#6 lore raw
In reply to Emil Goode

Hello Dan,

Sorry will look at it again and send another patch, perhaps tomorrow.

Thanks for catching my mistakes!

Best regards,
Emil Goode

Quoted 18 lines · Dan Carpenter
Quoted 3 lines · Emil Goode

This patch silences some sparse warnings and adds some line breaks to take the 80 char limit coding style rule in consideration.

Don't mix long line changes and sparse changes.

You missed some fp->binder casts so there are still Sparse warnings. Anyway, these sparse annotations should probably go into the struct binder_node definition in the .h file instead of always casting. (I haven't verified. So be careful).

Don't forget to get to run your patches through checkpatch.pl before sending them. (There are whitespace problems in your patch).

regards,
dan carpenter

#7 lore raw
In reply to Emil Goode

Em 23 de abril de 2012 15:12, Emil Goode <[email protected]> escreveu:

Quoted 3 lines

Hello Marcos,

Sorry, here are the sparse warnings that the patch fixes:

Oh, it was just a tip. People here always ask for the warnings. I believe that we agree that with it we can evaluate more easy, right?

Quoted 7 lines

drivers/staging/android/binder.c:1603:76: warning: incorrect type in argument 2 (different address spaces) drivers/staging/android/binder.c:1603:76: а аexpected void [noderef] <asn:1>*ptr
drivers/staging/android/binder.c:1603:76: а аgot void *binder drivers/staging/android/binder.c:1605:64: warning: incorrect type in argument 2 (different address spaces)

Quoted 9 lines

drivers/staging/android/binder.c:1605:64: а аexpected void [noderef] <asn:1>*ptr
drivers/staging/android/binder.c:1605:64: а аgot void *binder drivers/staging/android/binder.c:1605:76: warning: incorrect type in argument 3 (different address spaces) drivers/staging/android/binder.c:1605:76: а аexpected void [noderef] <asn:1>*cookie
drivers/staging/android/binder.c:1605:76: а аgot void *cookie

I believe that if you can resend your patch with this warnings in the commit message, and split the sparse fixes and the checkpatch fixes, it will be more easy to apply.

What do you think? Could you resend?

Nice job :)

Quoted 97 lines · Marcos Souza
Quoted 93 lines

Resend in plain text, sorry...

Quoted 76 lines

Em 23 de abril de 2012 14:23, Emil Goode <[email protected]> escreveu:

Quoted 4 lines

This patch silences some sparse warnings and adds some line breaks to take the 80 char limit coding style rule in consideration.

Nice work Emil!

What do you think to put the sparse warnings in the commit message?

I think it is better to understand аwhat are you trying to fix.

Quoted 50 lines

---
аdrivers/staging/android/binder.c | а 14 ++++++++++---- а1 file changed, 10 insertions(+), 4 deletions(-)

drivers/staging/android/binder.c +0 -0
index c283212..5d31417 100644
@@ -1600,15 +1600,21 @@ static void binder_transaction(struct binder_proc
 *proc,

а а а а а а а аcase BINDER_TYPE_BINDER:
а а а а а а а аcase BINDER_TYPE_WEAK_BINDER: {
а а а а а а а а а а а аstruct binder_ref *ref;
- а а а а а а а а а а а struct binder_node *node = binder_get_node(proc, fp->binder);
+ а а а а а а а а а а а struct binder_node *node = binder_get_node(proc,
+ а а а а а а а а а а а а а а а а а а а а а а а а а а(void __user *)fp->binder);
а а а а а а а а а а а аif (node = NULL) {
- а а а а а а а а а а а а а а а node = binder_new_node(proc, fp->binder, fp->cookie);
+ а а а а а а а а а а а а а а а node = binder_new_node(proc,
+ а а а а а а а а а а а а а а а а а а а а а а а (void __user *)fp->binder,
+ а а а а а а а а а а а а а а а а а а а а а а а (void __user *)fp->cookie);
а а а а а а а а а а а а а а а аif (node = NULL) {
а а а а а а а а а а а а а а а а а а а аreturn_error = BR_FAILED_REPLY; а а а а а а а а а а а а а а а а а а а аgoto err_binder_new_node_failed; а а а а а а а а а а а а а а а а}
- а а а а а а а а а а а а а а а node->min_priority = fp->flags & FLAT_BINDER_FLAG_PRIORITY_MASK;
- а а а а а а а а а а а а а а а node->accept_fds = !!(fp->flags & FLAT_BINDER_FLAG_ACCEPTS_FDS);
+ а а а а а а а а а а а а а а а node->min_priority = fp->flags & +
FLAT_BINDER_FLAG_PRIORITY_MASK;

drivers/staging/android/binder.c +3 -0
+
+ а а а а а а а а а а а а а а а node->accept_fds = !!(fp->flags &
+

FLAT_BINDER_FLAG_ACCEPTS_FDS);
а а а а а а а а а а а а}
а а а а а а а а а а а аif (fp->cookie != node->cookie) {
а а а а а а а а а а а а а а а аbinder_user_error("binder: %d:%d sending u%p "
--
1.7.9.5

Quoted 5 lines

--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to [email protected]
More majordomo info at аhttp://vger.kernel.org/majordomo-info.html

--
Att,

Quoted 4 lines

Marcos Paulo de Souza
Acadъmico de Ciencia da Computaчуo - FURB - SC "Uma vida sem desafios щ uma vida sem razуo" "A life without challenges, is a non reason life"

--
Att,

Marcos Paulo de Souza
Acadъmico de Ciencia da Computaчуo - FURB - SC "Uma vida sem desafios щ uma vida sem razуo" "A life without challenges, is a non reason life"

Signature · 10 lines
Att,

Marcos Paulo de Souza
Acadъmico de Ciencia da Computaчуo - FURB - SC
"Uma vida sem desafios щ uma vida sem razуo"
"A life without challenges, is a non reason life"
--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#8 lore raw
In reply to Emil Goode
Quoted 7 lines · Dan Carpenter
Quoted 2 lines · Marcos Souza

Resend in plain text, sorry...

Content-Transfer-Encoding: 8bit
Content-Type: text/plain; charset=utf-8

Hm.. Actually this was added by my email program when it saved the message.

I'm still not clear on how the original message was wrong or what to do to fix it...

regards,
dan carpenter