From: Mikko Perttunen <mperttunen@nvidia.com>
To: thierry.reding@gmail.com, jonathanh@nvidia.com
Cc: digetx@gmail.com, dri-devel@lists.freedesktop.org,
linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org,
Mikko Perttunen <mperttunen@nvidia.com>
Subject: [PATCH v2 6/6] drm/tegra: Use u64_to_user_ptr helper
Date: Tue, 5 Sep 2017 11:10:29 +0300 [thread overview]
Message-ID: <20170905081029.19769-7-mperttunen@nvidia.com> (raw)
In-Reply-To: <20170905081029.19769-1-mperttunen@nvidia.com>
Use the u64_to_user_ptr helper macro to cast IOCTL argument u64 values
to user pointers instead of writing out the cast manually.
Signed-off-by: Mikko Perttunen <mperttunen@nvidia.com>
---
drivers/gpu/drm/tegra/drm.c | 18 ++++++++++--------
1 file changed, 10 insertions(+), 8 deletions(-)
diff --git a/drivers/gpu/drm/tegra/drm.c b/drivers/gpu/drm/tegra/drm.c
index e3331a2bc082..72d5c0021540 100644
--- a/drivers/gpu/drm/tegra/drm.c
+++ b/drivers/gpu/drm/tegra/drm.c
@@ -388,18 +388,21 @@ int tegra_drm_submit(struct tegra_drm_context *context,
unsigned int num_cmdbufs = args->num_cmdbufs;
unsigned int num_relocs = args->num_relocs;
unsigned int num_waitchks = args->num_waitchks;
- struct drm_tegra_cmdbuf __user *cmdbufs =
- (void __user *)(uintptr_t)args->cmdbufs;
- struct drm_tegra_reloc __user *relocs =
- (void __user *)(uintptr_t)args->relocs;
- struct drm_tegra_waitchk __user *waitchks =
- (void __user *)(uintptr_t)args->waitchks;
+ struct drm_tegra_cmdbuf __user *cmdbufs;
+ struct drm_tegra_reloc __user *relocs;
+ struct drm_tegra_waitchk __user *waitchks;
+ struct drm_tegra_syncpt __user *user_syncpt;
struct drm_tegra_syncpt syncpt;
struct host1x *host1x = dev_get_drvdata(drm->dev->parent);
struct host1x_syncpt *sp;
struct host1x_job *job;
int err;
+ cmdbufs = u64_to_user_ptr(args->cmdbufs);
+ relocs = u64_to_user_ptr(args->relocs);
+ waitchks = u64_to_user_ptr(args->waitchks);
+ user_syncpt = u64_to_user_ptr(args->syncpts);
+
/* We don't yet support other than one syncpt_incr struct per submit */
if (args->num_syncpts != 1)
return -EINVAL;
@@ -520,8 +523,7 @@ int tegra_drm_submit(struct tegra_drm_context *context,
}
}
- if (copy_from_user(&syncpt, (void __user *)(uintptr_t)args->syncpts,
- sizeof(syncpt))) {
+ if (copy_from_user(&syncpt, user_syncpt, sizeof(syncpt))) {
err = -EFAULT;
goto fail;
}
--
2.14.1
next prev parent reply other threads:[~2017-09-05 8:10 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-05 8:10 [PATCH v2 0/6] Miscellaneous improvements to Host1x and TegraDRM Mikko Perttunen
2017-09-05 8:10 ` [PATCH v2 1/6] gpu: host1x: Enable Tegra186 syncpoint protection Mikko Perttunen
2017-09-05 13:33 ` Dmitry Osipenko
2017-09-22 14:02 ` Mikko Perttunen
2017-09-22 23:17 ` Dmitry Osipenko
2017-09-05 8:10 ` [PATCH v2 2/6] gpu: host1x: Enable gather filter Mikko Perttunen
2017-09-05 8:10 ` [PATCH v2 3/6] gpu: host1x: Improve debug disassembly formatting Mikko Perttunen
2017-09-05 8:10 ` [PATCH v2 4/6] gpu: host1x: Disassemble more instructions Mikko Perttunen
2017-09-05 13:02 ` Dmitry Osipenko
2017-09-05 8:10 ` [PATCH v2 5/6] gpu: host1x: Fix incorrect comment for channel_request Mikko Perttunen
2017-09-05 13:05 ` Dmitry Osipenko
2017-09-05 8:10 ` Mikko Perttunen [this message]
2017-09-05 12:41 ` [PATCH v2 6/6] drm/tegra: Use u64_to_user_ptr helper Dmitry Osipenko
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=20170905081029.19769-7-mperttunen@nvidia.com \
--to=mperttunen@nvidia.com \
--cc=digetx@gmail.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=jonathanh@nvidia.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tegra@vger.kernel.org \
--cc=thierry.reding@gmail.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;
as well as URLs for NNTP newsgroup(s).