Skip to contentSkip to conversation

Mark a pointer as an userspace pointer using __user macro.

PATCH New Antoine BLIN 3 participants 3 messages Apr 10, 2016 – Apr 12, 2016 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Mark a pointer as an userspace pointer using __user macro.

This change fixes below sparse error: "error: incompatible types in comparison expression (different address spaces)"

---
 drivers/staging/lustre/lnet/selftest/conrpc.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/staging/lustre/lnet/selftest/conrpc.c +3 -3
index 2be9451..1fdabb3 100644
@@ -490,10 +490,10 @@ lstcon_rpc_trans_interpreter(lstcon_rpc_trans_t *trans,
 				   sizeof(struct list_head)))
 			return -EFAULT;
 
-		if (tmp.next == head_up)
-			return 0;
+		next = (struct list_head __user *)tmp.next;
 
-		next = tmp.next;
+		if (next == head_up)
+			return 0;
 
 		ent = list_entry(next, lstcon_rpc_ent_t, rpe_link);
 
Signature · 1 line
2.7.4
maintainer
#1 lore raw

PATCH 1/1 Mark a pointer as an userspace pointer using __user macro.

Quoted 7 lines · Antoine BLIN

This change fixes below sparse error: "error: incompatible types in comparison expression (different address spaces)"

---
 drivers/staging/lustre/lnet/selftest/conrpc.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Please always cc: the driverdev mailing list for staging patches.

Also use the name of the driver, and the subsystem in the patch, like the others written for this driver, look at 'git log' for details.

drivers/staging/lustre/lnet/selftest/conrpc.c lstcon_rpc_trans_interpreter(lstcon_rpc_trans_t *trans, · line 493

Quoted 12 lines
drivers/staging/lustre/lnet/selftest/conrpc.c +1 -2
index 2be9451..1fdabb3 100644
@@ -490,10 +490,10 @@ lstcon_rpc_trans_interpreter(lstcon_rpc_trans_t *trans,
 				   sizeof(struct list_head)))
 			return -EFAULT;
 
-		if (tmp.next == head_up)
-			return 0;
+		next = (struct list_head __user *)tmp.next;

Kernel structures in userspace? While that might be the case, this really should be fixed "properly" and not papered over like this, sorry.

Do you have access to a lustre system to test changes like this?

thanks,

greg k-h

#2 lore raw

PATCH 1/1 Mark a pointer as an userspace pointer using __user macro.

In reply to Antoine BLIN
Quoted 5 lines

This change fixes below sparse error: "error: incompatible types in comparison expression (different address spaces)"

Sigh, I thought the worst was behind us for the LNet/libcfs cleanup. I agree with Greg this is just papering over the problem. Properly fixing this will require the tools to be fixed as well. I wonder if ioctls are best way to handle this, perhaps debugfs?

Quoted 30 lines
---
 drivers/staging/lustre/lnet/selftest/conrpc.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/staging/lustre/lnet/selftest/conrpc.c +3 -3
index 2be9451..1fdabb3 100644
@@ -490,10 +490,10 @@ lstcon_rpc_trans_interpreter(lstcon_rpc_trans_t *trans,
 				   sizeof(struct list_head)))
 			return -EFAULT;
 
-		if (tmp.next == head_up)
-			return 0;
+		next = (struct list_head __user *)tmp.next;
 
-		next = tmp.next;
+		if (next == head_up)
+			return 0;
 
 		ent = list_entry(next, lstcon_rpc_ent_t, rpe_link);
 
Signature · 6 lines
2.7.4

_______________________________________________
lustre-devel mailing list
lustre-devel at lists.lustre.org
http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org