linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] staging: vchiq_arm: Using copy_from_user() to copy data from userspace address
@ 2021-05-22  5:34 Nguyen Dinh Phi
  2021-05-22  6:33 ` Al Viro
  0 siblings, 1 reply; 4+ messages in thread
From: Nguyen Dinh Phi @ 2021-05-22  5:34 UTC (permalink / raw)
  To: nsaenz, gregkh, stefan.wahren, arnd, dan.carpenter, phil, amarjargal16
  Cc: bcm-kernel-feedback-list, linux-rpi-kernel, linux-arm-kernel,
	linux-staging, linux-kernel

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 <phind.uet@gmail.com>
---
 .../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))) {
+			ret = -EFAULT;
+			goto out;
+		}
 	}
 
 	status = vchiq_bulk_transfer(args->handle, NULL, args->data, args->size,
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-05-25  2:12 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-22  5:34 [PATCH] staging: vchiq_arm: Using copy_from_user() to copy data from userspace address Nguyen Dinh Phi
2021-05-22  6:33 ` Al Viro
2021-05-24 17:26   ` Phi Nguyen
2021-05-25  2:12     ` Al Viro

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).