lkml.org 
[lkml]   [2021]   [May]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] staging: vchiq_arm: Using copy_from_user() to copy data from userspace address
On Sat, May 22, 2021 at 01:34:29PM +0800, Nguyen Dinh Phi wrote:
> 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))) {

The contents of userdata (local variable of type void *) is uninitialized at that
point. Just what do you think that call of copy_from_user() would do?

\
 
 \ /
  Last update: 2021-05-22 08:35    [W:0.047 / U:2.128 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site