AMD-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Christian König" <ckoenig.leichtzumerken@gmail.com>
To: Alex Deucher <alexdeucher@gmail.com>, amd-gfx@lists.freedesktop.org
Cc: Alex Deucher <alexander.deucher@amd.com>
Subject: Re: [PATCH] drm/amdgpu: check the result of copy_from_user in secure display debugfs
Date: Mon, 4 Jan 2021 18:47:21 +0100	[thread overview]
Message-ID: <995d51e6-274e-ab2f-3da4-a8dc476fc19a@gmail.com> (raw)
In-Reply-To: <20210104174349.609143-1-alexander.deucher@amd.com>

Am 04.01.21 um 18:43 schrieb Alex Deucher:
> Make sure the copy succeeded.  Also fixes a warning.
>
> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_securedisplay.c | 4 +++-
>   1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_securedisplay.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_securedisplay.c
> index 455978781380..1f98ce4e56f2 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_securedisplay.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_securedisplay.c
> @@ -101,7 +101,9 @@ static ssize_t amdgpu_securedisplay_debugfs_write(struct file *f, const char __u
>   		return -EINVAL;
>   
>   	memset(str,  0, sizeof(str));
> -	copy_from_user(str, buf, size);
> +	ret = copy_from_user(str, buf, size);
> +	if (ret >= size)
> +		return -EINVAL;

IIRC copy_from_user return the number of bytes which couldn't be copied.

E.g. theta should be if (ret) return -EFAULT.

Christian.

>   
>   	ret = pm_runtime_get_sync(dev->dev);
>   	if (ret < 0) {

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

      reply	other threads:[~2021-01-04 17:47 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-04 17:43 [PATCH] drm/amdgpu: check the result of copy_from_user in secure display debugfs Alex Deucher
2021-01-04 17:47 ` Christian König [this message]

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=995d51e6-274e-ab2f-3da4-a8dc476fc19a@gmail.com \
    --to=ckoenig.leichtzumerken@gmail.com \
    --cc=alexander.deucher@amd.com \
    --cc=alexdeucher@gmail.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=christian.koenig@amd.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