public inbox for linux-staging@lists.linux.dev
 help / color / mirror / Atom feed
From: Nguyen Dinh Phi <phind.uet@gmail.com>
To: nsaenz@kernel.org, gregkh@linuxfoundation.org,
	stefan.wahren@i2se.com, arnd@arndb.de, dan.carpenter@oracle.com,
	phil@raspberrypi.com, amarjargal16@gmail.com
Cc: bcm-kernel-feedback-list@broadcom.com,
	linux-rpi-kernel@lists.infradead.org,
	linux-arm-kernel@lists.infradead.org,
	linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: [PATCH] staging: vchiq_arm: Using copy_from_user() to copy data from userspace address
Date: Sat, 22 May 2021 13:34:29 +0800	[thread overview]
Message-ID: <20210522053429.82710-1-phind.uet@gmail.com> (raw)

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


             reply	other threads:[~2021-05-22  5:34 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-22  5:34 Nguyen Dinh Phi [this message]
2021-05-22  6:33 ` [PATCH] staging: vchiq_arm: Using copy_from_user() to copy data from userspace address Al Viro
2021-05-24 17:26   ` Phi Nguyen
2021-05-25  2:12     ` Al Viro

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210522053429.82710-1-phind.uet@gmail.com \
    --to=phind.uet@gmail.com \
    --cc=amarjargal16@gmail.com \
    --cc=arnd@arndb.de \
    --cc=bcm-kernel-feedback-list@broadcom.com \
    --cc=dan.carpenter@oracle.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rpi-kernel@lists.infradead.org \
    --cc=linux-staging@lists.linux.dev \
    --cc=nsaenz@kernel.org \
    --cc=phil@raspberrypi.com \
    --cc=stefan.wahren@i2se.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox