Thread (4 messages) 4 messages, 2 authors, 2021-05-25

Re: [PATCH] staging: vchiq_arm: Using copy_from_user() to copy data from userspace address

From: Phi Nguyen <hidden>
Date: 2021-05-24 17:26:36
Also in: linux-staging, lkml

On 22/5/21 2:33 pm, Al Viro wrote:
On Sat, May 22, 2021 at 01:34:29PM +0800, Nguyen Dinh Phi wrote:
quoted
This commit to fix the following sparse warning:
incorrect type in assignment (different address spaces)
expected void *[assigned] userdata
got void [noderef] __user *userdata

Signed-off-by: Nguyen Dinh Phi <redacted>
---
  .../staging/vc04_services/interface/vchiq_arm/vchiq_arm.c    | 5 ++++-
  1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
index afbf01b7364c..2a4fc599f977 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
@@ -960,7 +960,10 @@ static int vchiq_irq_queue_bulk_tx_rx(struct vchiq_instance *instance,
  			current->pid);
  		userdata = &waiter->bulk_waiter;
  	} else {
-		userdata = args->userdata;
+		if (copy_from_user(userdata, args->userdata, sizeof(args->userdata))) {
	The contents of userdata (local variable of type void *) is uninitialized at that
point.
Sorry, That was my mistake.
Just what do you think that call of copy_from_user() would do? 
Because according to the definition of struct vchiq_queue_bulk_transfer, 
the args->userdata pointer is userspace address.

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help