drivers: staging/lustre: conrpc.c - fix sparse error: incompatible types in comparison expression (different address spaces)
PATCH 1/1 drivers: staging/lustre: conrpc.c - fix sparse error: incompatible types in comparison expression (different address spaces)
--- 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.11.0
This patch makes a lot of new warnings pop up, because the error is blocking the rest of the file from being processed.
Quoted 21 lines · Guillermo O. Freschi
Signed-off-by Guillermo O. Freschi <[email protected]>--- drivers/staging/lustre/lnet/selftest/conrpc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/staging/lustre/lnet/selftest/conrpc.c +1
-2@@ -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; --2.11.0
PATCH 1/1 drivers: staging/lustre: conrpc.c - fix sparse error: incompatible types in comparison expression (different address spaces)
This is fairly minor but it reveals a few hidden warnings, could I get some feedback on it?
Thanks
--
Guillermo
Quoted 9 lines · Tordek
This patch makes a lot of new warnings pop up, because the error is blocking the rest of the file from being processed.
Quoted 5 lines · Guillermo O. Freschi
Signed-off-by Guillermo O. Freschi <[email protected]>--- drivers/staging/lustre/lnet/selftest/conrpc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 19 lines
Review
Quoted 1 line
(quoted diff) +0
-0
b/drivers/staging/lustre/lnet/selftest/conrpc.cdrivers/staging/lustre/lnet/selftest/conrpc.c lstcon_rpc_trans_interpreter(struct
Quoted 4 lines
index
da36c55b86d3..f4578200994f100644drivers/staging/lustre/lnet/selftest/conrpc.c +0
-0@@ -487,7 +487,7 @@ lstcon_rpc_trans_interpreter(struct
lstcon_rpc_trans*trans,Quoted 11 lines
drivers/staging/lustre/lnet/selftest/conrpc.c +1
-2sizeof(struct list_head)))return -EFAULT ; -if (tmp.next == head_up) +if ((struct list_head __user *)tmp.next == head_up)return 0 ; next = tmp.next; --2.11.0
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lustre.org/pipermail/lustre-devel-lustre.org/attachments/20170601/e759a8cd/attachment.htm>
Quoted 1 line · Tordek
This is fairly minor but it reveals a few hidden warnings, could I get some feedback on it?
This is a known problem, but can't immediately be fixed because it affects the interface with userspace tools. The correct solution is to not use struct list_head in the user interface at all, and we are looking into that.
In the meantime, feel free to look at the warnings that are now visible after this patch is applied (locally on your system).
Thanks, Andreas
Quoted 23 lines · Tordek
This patch makes a lot of new warnings pop up, because the error is blocking the rest of the file from being processed.
Quoted 17 lines · Guillermo O. Freschi
Signed-off-by Guillermo O. Freschi <[email protected]>---
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 ;
Quoted 8 lines
Quoted 4 lines
drivers/staging/lustre/lnet/selftest/conrpc.c +0
-1next = tmp.next; --2.11.0
_______________________________________________
lustre-devel mailing list
lustre-devel at lists.lustre.org
http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org
Cheers, Andreas
--
Andreas Dilger
Lustre Principal Architect
Intel Corporation
Quoted 9 lines · Andreas
Quoted 1 line · Tordek
This is fairly minor but it reveals a few hidden warnings, could I get some feedback on it?
This is a known problem, but can't immediately be fixed because it affects the interface with userspace tools. The correct solution is to not use struct
list_headin the user interface at all, and we are looking into that.In the meantime, feel free to look at the warnings that are now visible after this patch is applied (locally on your system).
Well, changing
struct lstcon_rpc_ent *ent;
to
struct lstcon_rpc_ent __user *ent;
makes most of the post-patch warnings disappear (and it... makes sense? we're calling copy_to_user(&ent... a lot, so I assume ent would be pointing to userspace memory).
But if this is meant to change, maybe it's a moot point to look at it at all.
Thanks!
Quoted 35 lines
Thanks, Andreas
Quoted 23 lines · Tordek
This patch makes a lot of new warnings pop up, because the error is blocking the rest of the file from being processed.
Quoted 17 lines · Guillermo O. Freschi
Signed-off-by Guillermo O. Freschi <[email protected]>---
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 ;Quoted 8 lines
Quoted 4 lines
drivers/staging/lustre/lnet/selftest/conrpc.c +0
-1next = tmp.next; --2.11.0
_______________________________________________
lustre-devel mailing list
lustre-devel at lists.lustre.org
http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org
Quoted 12 lines
Cheers, Andreas
--
Andreas Dilger
Lustre Principal Architect
Intel Corporation
--
Tordek
PATCH 1/2 drivers: staging/lustre: conrpc.c - fix sparse error: incompatible types in comparison expression (different address spaces)
In reply to Dilger, AndreasThis patch reveals hidden warnings after this line.
(This is a stepping-stone patch for the following one, it should be ignored as per Andreas Dilger.)
--- 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.11.0
PATCH 2/2 drivers: staging/lustre: conrpc.c - fix sparse warning: warning: incorrect type in argument * (different address spaces)
The calls to copy_to_user suggest that ent is pointing to userspace memory, but ent is missing the __user qualifier.
--- drivers/staging/lustre/lnet/selftest/conrpc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/lustre/lnet/selftest/conrpc.c +1 -1
@@ -469,7 +469,7 @@ lstcon_rpc_trans_interpreter(struct lstcon_rpc_trans *trans, {struct list_head tmp;struct list_head __user *next; -struct lstcon_rpc_ent *ent; +struct lstcon_rpc_ent __user *ent;struct srpc_generic_reply *rep;struct lstcon_rpc *crpc;struct srpc_msg *msg;
Signature · 1 line
2.11.0
This is fairly minor but it reveals a few hidden warnings, could I get some feedback on it?
Thanks
--
Guillermo
Quoted 25 lines · Tordek
This patch makes a lot of new warnings pop up, because the error is blocking the rest of the file from being processed.
Quoted 21 lines · Guillermo O. Freschi
Signed-off-by Guillermo O. Freschi <[email protected]>--- drivers/staging/lustre/lnet/selftest/conrpc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/staging/lustre/lnet/selftest/conrpc.c +1
-2@@ -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; --2.11.0