staging: lusten: conrpc.c: fix different address space sparse warning
PATCH 1/1 staging: lusten: conrpc.c: fix different address space sparse warning
head_up parameter is marked with __user attribute, tmp is filled by a copy_from_user from next, that is also marked as __user, so tmp.next needs to be "casted" as __user to make sparse happy.
---
this is mt first patch addressing an issue of sparse, so let me know if I misunderstood the error message
drivers/staging/lustre/lnet/selftest/conrpc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/lustre/lnet/selftest/conrpc.c +1 -1
@@ -487,7 +487,7 @@ lstcon_rpc_trans_interpreter(struct lstcon_rpc_trans *trans, sizeof(struct list_head)))return -EFAULT ; -if (tmp.next == head_up) +if ((struct list_head __user *)tmp.next == head_up)return 0 ; next = tmp.next;
Signature · 1 line
2.9.3
Greg KH
maintainerQuoted 3 lines · Marcos Paulo de Souza
head_upparameter is marked with__userattribute, tmp is filled by acopy_from_userfrom next, that is also marked as__user, so tmp.next needs to be "casted" as__userto make sparse happy.
But is it the correct change?
You also have a typo in your subject :(
Quoted 14 lines
Signed-off-by Marcos Paulo de Souza <[email protected]>---
this is mt first patch addressing an issue of sparse, so let me know if I misunderstood the error message
drivers/staging/lustre/lnet/selftest/conrpc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/staging/lustre/lnet/selftest/conrpc.c +0
-0
drivers/staging/lustre/lnet/selftest/conrpc.c lstcon_rpc_trans_interpreter(struct lstcon_rpc_trans *trans, · line 490
Quoted 5 lines
drivers/staging/lustre/lnet/selftest/conrpc.c +1
-1@@ -487,7 +487,7 @@ lstcon_rpc_trans_interpreter(struct lstcon_rpc_trans *trans, sizeof(struct list_head)))return -EFAULT ; -if (tmp.next == head_up) +if ((struct list_head __user *)tmp.next == head_up)
Aer you sure this is correct? __user changes for lustre is not trivial...
How did you test this?
thanks,
greg k-h
Quoted 6 lines · Greg KH
Quoted 3 lines · Marcos Paulo de Souza
head_upparameter is marked with__userattribute, tmp is filled by acopy_from_userfrom next, that is also marked as__user, so tmp.next needs to be "casted" as__userto make sparse happy.But is it the correct change?
I don't know, it's my first sparse patch, so I tried to fix this warning.
Quoted 2 lines
You also have a typo in your subject :(
Sorry, didn't noticed yesterday :(
Quoted 18 lines
Quoted 18 lines
Signed-off-by Marcos Paulo de Souza <[email protected]>---
this is mt first patch addressing an issue of sparse, so let me know if I misunderstood the error message
drivers/staging/lustre/lnet/selftest/conrpc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/staging/lustre/lnet/selftest/conrpc.c +0
-0@@ -487,7 +487,7 @@ lstcon_rpc_trans_interpreter(struct lstcon_rpc_trans *trans, sizeof(struct list_head)))return -EFAULT ;
Quoted 7 lines
drivers/staging/lustre/lnet/selftest/conrpc.c lstcon_rpc_trans_interpreter(struct lstcon_rpc_trans *trans, · line 490
Quoted 2 lines
drivers/staging/lustre/lnet/selftest/conrpc.c +1
-1-if (tmp.next == head_up) +if ((struct list_head __user *)tmp.next == head_up)Aer you sure this is correct?
__userchanges for lustre is not trivial...How did you test this?
I didn't tested, it just removed the warning. Is this a false positive?
Quoted 4 lines
thanks,
greg k-h
Signature · 2 lines
Thanks, Marcos
Greg KH
maintainerQuoted 40 lines · Marcos Paulo de Souza
Quoted 6 lines · Greg KH
Quoted 3 lines · Marcos Paulo de Souza
head_upparameter is marked with__userattribute, tmp is filled by acopy_from_userfrom next, that is also marked as__user, so tmp.next needs to be "casted" as__userto make sparse happy.But is it the correct change?
I don't know, it's my first sparse patch, so I tried to fix this warning.
Quoted 2 lines
You also have a typo in your subject :(
Sorry, didn't noticed yesterday :(
Quoted 24 lines
Quoted 15 lines
Signed-off-by Marcos Paulo de Souza <[email protected]>---
this is mt first patch addressing an issue of sparse, so let me know if I misunderstood the error message
drivers/staging/lustre/lnet/selftest/conrpc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/staging/lustre/lnet/selftest/conrpc.c +0
-0drivers/staging/lustre/lnet/selftest/conrpc.c lstcon_rpc_trans_interpreter(struct lstcon_rpc_trans *trans, · line 490
Quoted 5 lines
drivers/staging/lustre/lnet/selftest/conrpc.c +1
-1@@ -487,7 +487,7 @@ lstcon_rpc_trans_interpreter(struct lstcon_rpc_trans *trans, sizeof(struct list_head)))return -EFAULT ; -if (tmp.next == head_up) +if ((struct list_head __user *)tmp.next == head_up)Aer you sure this is correct?
__userchanges for lustre is not trivial...
Quoted 3 lines
Quoted 1 line
How did you test this?
I didn't tested, it just removed the warning. Is this a false positive?
I don't know, it's up to you to prove to me that you know this change is correct. You have to justify your changes, and "because checkpatch.pl complained" isn't a valid justification for something like this :)
thanks,
greg k-h
Quoted 41 lines · Greg KH
Quoted 40 lines · Marcos Paulo de Souza
Quoted 6 lines · Greg KH
Quoted 3 lines · Marcos Paulo de Souza
head_upparameter is marked with__userattribute, tmp is filled by acopy_from_userfrom next, that is also marked as__user, so tmp.next needs to be "casted" as__userto make sparse happy.But is it the correct change?
I don't know, it's my first sparse patch, so I tried to fix this warning.
Quoted 2 lines
You also have a typo in your subject :(
Sorry, didn't noticed yesterday :(
Quoted 24 lines
Quoted 15 lines
Signed-off-by Marcos Paulo de Souza <[email protected]>---
this is mt first patch addressing an issue of sparse, so let me know if I misunderstood the error message
drivers/staging/lustre/lnet/selftest/conrpc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/staging/lustre/lnet/selftest/conrpc.c +0
-0drivers/staging/lustre/lnet/selftest/conrpc.c lstcon_rpc_trans_interpreter(struct lstcon_rpc_trans *trans, · line 490
Quoted 5 lines
drivers/staging/lustre/lnet/selftest/conrpc.c +1
-1@@ -487,7 +487,7 @@ lstcon_rpc_trans_interpreter(struct lstcon_rpc_trans *trans, sizeof(struct list_head)))return -EFAULT ; -if (tmp.next == head_up) +if ((struct list_head __user *)tmp.next == head_up)Aer you sure this is correct?
__userchanges for lustre is not trivial...
Quoted 7 lines
Quoted 3 lines
Quoted 1 line
How did you test this?
I didn't tested, it just removed the warning. Is this a false positive?
I don't know, it's up to you to prove to me that you know this change is correct. You have to justify your changes, and "because checkpatch.pl complained" isn't a valid justification for something like this :)
Fair enough, I'll take in another sparse report to work on. Thanks!
Quoted 4 lines
thanks,
greg k-h
Signature · 2 lines
Thanks, Marcos