AMD-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Felix Kuehling <felix.kuehling@amd.com>
To: Dan Carpenter <dan.carpenter@oracle.com>,
	Rajneesh Bhardwaj <rajneesh.bhardwaj@amd.com>
Cc: "David Airlie" <airlied@linux.ie>,
	"Pan, Xinhui" <Xinhui.Pan@amd.com>,
	kernel-janitors@vger.kernel.org, amd-gfx@lists.freedesktop.org,
	dri-devel@lists.freedesktop.org,
	"Daniel Vetter" <daniel@ffwll.ch>,
	"Alex Deucher" <alexander.deucher@amd.com>,
	"Christian König" <christian.koenig@amd.com>
Subject: Re: [PATCH] drm/amdkfd: CRIU return -EFAULT for copy_to_user() failure
Date: Wed, 9 Feb 2022 15:34:08 -0500	[thread overview]
Message-ID: <8b59e237-9d0c-bccd-4b55-3000dc045061@amd.com> (raw)
In-Reply-To: <20220209180958.GC18385@kili>


On 2022-02-09 13:09, Dan Carpenter wrote:
> If copy_to_user() fails, it returns the number of bytes remaining to
> be copied but we want to return a negative error code (-EFAULT) to the
> user.
>
> Fixes: 9d5dabfeff3c ("drm/amdkfd: CRIU Save Shared Virtual Memory ranges")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Thank you Dan. I'm applying your two patches to amd-staging-drm-next.

Regards,
   Felix

> ---
>   drivers/gpu/drm/amd/amdkfd/kfd_svm.c | 6 +++---
>   1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_svm.c b/drivers/gpu/drm/amd/amdkfd/kfd_svm.c
> index 41f03d165bad..38a056fd0966 100644
> --- a/drivers/gpu/drm/amd/amdkfd/kfd_svm.c
> +++ b/drivers/gpu/drm/amd/amdkfd/kfd_svm.c
> @@ -3775,10 +3775,10 @@ int kfd_criu_checkpoint_svm(struct kfd_process *p,
>   			goto exit_priv;
>   		}
>   
> -		ret = copy_to_user(user_priv_data + *priv_data_offset,
> -				   svm_priv, svm_priv_data_size);
> -		if (ret) {
> +		if (copy_to_user(user_priv_data + *priv_data_offset, svm_priv,
> +				 svm_priv_data_size)) {
>   			pr_err("Failed to copy svm priv to user\n");
> +			ret = -EFAULT;
>   			goto exit_priv;
>   		}
>   

      reply	other threads:[~2022-02-09 20:34 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-09 18:09 [PATCH] drm/amdkfd: CRIU return -EFAULT for copy_to_user() failure Dan Carpenter
2022-02-09 20:34 ` Felix Kuehling [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=8b59e237-9d0c-bccd-4b55-3000dc045061@amd.com \
    --to=felix.kuehling@amd.com \
    --cc=Xinhui.Pan@amd.com \
    --cc=airlied@linux.ie \
    --cc=alexander.deucher@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=christian.koenig@amd.com \
    --cc=dan.carpenter@oracle.com \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=rajneesh.bhardwaj@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