All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Dixit, Ashutosh" <ashutosh.dixit@intel.com>
To: Harish Chegondi <harish.chegondi@intel.com>
Cc: <intel-xe@lists.freedesktop.org>, kees@kernel.org
Subject: Re: [PATCH 1/1] drm/xe: Use copy_from_user() instead of __copy_from_user()
Date: Thu, 01 May 2025 19:34:27 -0700	[thread overview]
Message-ID: <87y0vfspu4.wl-ashutosh.dixit@intel.com> (raw)
In-Reply-To: <acabf20aa8621c7bc8de09b1bffb8d14b5376484.1746126614.git.harish.chegondi@intel.com>

On Thu, 01 May 2025 12:14:45 -0700, Harish Chegondi wrote:
>
> copy_from_user() has more checks and is more safer than
> __copy_from_user()
>

Will add a:

Suggested-by: Kees Cook <kees@kernel.org>

before merging this, but otherwise:

Reviewed-by: Ashutosh Dixit <ashutosh.dixit@intel.com>

> Signed-off-by: Harish Chegondi <harish.chegondi@intel.com>
> ---
>  drivers/gpu/drm/xe/xe_bo.c         | 4 ++--
>  drivers/gpu/drm/xe/xe_eu_stall.c   | 4 ++--
>  drivers/gpu/drm/xe/xe_exec.c       | 4 ++--
>  drivers/gpu/drm/xe/xe_exec_queue.c | 9 ++++-----
>  drivers/gpu/drm/xe/xe_oa.c         | 6 +++---
>  drivers/gpu/drm/xe/xe_vm.c         | 6 +++---
>  6 files changed, 16 insertions(+), 17 deletions(-)
>
> diff --git a/drivers/gpu/drm/xe/xe_bo.c b/drivers/gpu/drm/xe/xe_bo.c
> index 3a84a9d92c48..d99d91fe8aa9 100644
> --- a/drivers/gpu/drm/xe/xe_bo.c
> +++ b/drivers/gpu/drm/xe/xe_bo.c
> @@ -2569,7 +2569,7 @@ static int gem_create_user_ext_set_property(struct xe_device *xe,
>	int err;
>	u32 idx;
>
> -	err = __copy_from_user(&ext, address, sizeof(ext));
> +	err = copy_from_user(&ext, address, sizeof(ext));
>	if (XE_IOCTL_DBG(xe, err))
>		return -EFAULT;
>
> @@ -2606,7 +2606,7 @@ static int gem_create_user_extensions(struct xe_device *xe, struct xe_bo *bo,
>	if (XE_IOCTL_DBG(xe, ext_number >= MAX_USER_EXTENSIONS))
>		return -E2BIG;
>
> -	err = __copy_from_user(&ext, address, sizeof(ext));
> +	err = copy_from_user(&ext, address, sizeof(ext));
>	if (XE_IOCTL_DBG(xe, err))
>		return -EFAULT;
>
> diff --git a/drivers/gpu/drm/xe/xe_eu_stall.c b/drivers/gpu/drm/xe/xe_eu_stall.c
> index e2bb156c71fb..96732613b4b7 100644
> --- a/drivers/gpu/drm/xe/xe_eu_stall.c
> +++ b/drivers/gpu/drm/xe/xe_eu_stall.c
> @@ -283,7 +283,7 @@ static int xe_eu_stall_user_ext_set_property(struct xe_device *xe, u64 extension
>	int err;
>	u32 idx;
>
> -	err = __copy_from_user(&ext, address, sizeof(ext));
> +	err = copy_from_user(&ext, address, sizeof(ext));
>	if (XE_IOCTL_DBG(xe, err))
>		return -EFAULT;
>
> @@ -313,7 +313,7 @@ static int xe_eu_stall_user_extensions(struct xe_device *xe, u64 extension,
>	if (XE_IOCTL_DBG(xe, ext_number >= MAX_USER_EXTENSIONS))
>		return -E2BIG;
>
> -	err = __copy_from_user(&ext, address, sizeof(ext));
> +	err = copy_from_user(&ext, address, sizeof(ext));
>	if (XE_IOCTL_DBG(xe, err))
>		return -EFAULT;
>
> diff --git a/drivers/gpu/drm/xe/xe_exec.c b/drivers/gpu/drm/xe/xe_exec.c
> index b75adfc99fb7..44364c042ad7 100644
> --- a/drivers/gpu/drm/xe/xe_exec.c
> +++ b/drivers/gpu/drm/xe/xe_exec.c
> @@ -176,8 +176,8 @@ int xe_exec_ioctl(struct drm_device *dev, void *data, struct drm_file *file)
>	}
>
>	if (xe_exec_queue_is_parallel(q)) {
> -		err = __copy_from_user(addresses, addresses_user, sizeof(u64) *
> -				       q->width);
> +		err = copy_from_user(addresses, addresses_user, sizeof(u64) *
> +				     q->width);
>		if (err) {
>			err = -EFAULT;
>			goto err_syncs;
> diff --git a/drivers/gpu/drm/xe/xe_exec_queue.c b/drivers/gpu/drm/xe/xe_exec_queue.c
> index 606922d9dd73..21d4ced31dd9 100644
> --- a/drivers/gpu/drm/xe/xe_exec_queue.c
> +++ b/drivers/gpu/drm/xe/xe_exec_queue.c
> @@ -479,7 +479,7 @@ static int exec_queue_user_ext_set_property(struct xe_device *xe,
>	int err;
>	u32 idx;
>
> -	err = __copy_from_user(&ext, address, sizeof(ext));
> +	err = copy_from_user(&ext, address, sizeof(ext));
>	if (XE_IOCTL_DBG(xe, err))
>		return -EFAULT;
>
> @@ -518,7 +518,7 @@ static int exec_queue_user_extensions(struct xe_device *xe, struct xe_exec_queue
>	if (XE_IOCTL_DBG(xe, ext_number >= MAX_USER_EXTENSIONS))
>		return -E2BIG;
>
> -	err = __copy_from_user(&ext, address, sizeof(ext));
> +	err = copy_from_user(&ext, address, sizeof(ext));
>	if (XE_IOCTL_DBG(xe, err))
>		return -EFAULT;
>
> @@ -618,9 +618,8 @@ int xe_exec_queue_create_ioctl(struct drm_device *dev, void *data,
>	if (XE_IOCTL_DBG(xe, !len || len > XE_HW_ENGINE_MAX_INSTANCE))
>		return -EINVAL;
>
> -	err = __copy_from_user(eci, user_eci,
> -			       sizeof(struct drm_xe_engine_class_instance) *
> -			       len);
> +	err = copy_from_user(eci, user_eci,
> +			     sizeof(struct drm_xe_engine_class_instance) * len);
>	if (XE_IOCTL_DBG(xe, err))
>		return -EFAULT;
>
> diff --git a/drivers/gpu/drm/xe/xe_oa.c b/drivers/gpu/drm/xe/xe_oa.c
> index 346f357b3d1f..fb842fa0552e 100644
> --- a/drivers/gpu/drm/xe/xe_oa.c
> +++ b/drivers/gpu/drm/xe/xe_oa.c
> @@ -1301,7 +1301,7 @@ static int xe_oa_user_ext_set_property(struct xe_oa *oa, enum xe_oa_user_extn_fr
>	int err;
>	u32 idx;
>
> -	err = __copy_from_user(&ext, address, sizeof(ext));
> +	err = copy_from_user(&ext, address, sizeof(ext));
>	if (XE_IOCTL_DBG(oa->xe, err))
>		return -EFAULT;
>
> @@ -1338,7 +1338,7 @@ static int xe_oa_user_extensions(struct xe_oa *oa, enum xe_oa_user_extn_from fro
>	if (XE_IOCTL_DBG(oa->xe, ext_number >= MAX_USER_EXTENSIONS))
>		return -E2BIG;
>
> -	err = __copy_from_user(&ext, address, sizeof(ext));
> +	err = copy_from_user(&ext, address, sizeof(ext));
>	if (XE_IOCTL_DBG(oa->xe, err))
>		return -EFAULT;
>
> @@ -2281,7 +2281,7 @@ int xe_oa_add_config_ioctl(struct drm_device *dev, u64 data, struct drm_file *fi
>		return -EACCES;
>	}
>
> -	err = __copy_from_user(&param, u64_to_user_ptr(data), sizeof(param));
> +	err = copy_from_user(&param, u64_to_user_ptr(data), sizeof(param));
>	if (XE_IOCTL_DBG(oa->xe, err))
>		return -EFAULT;
>
> diff --git a/drivers/gpu/drm/xe/xe_vm.c b/drivers/gpu/drm/xe/xe_vm.c
> index 80e56e232685..62fbc746c883 100644
> --- a/drivers/gpu/drm/xe/xe_vm.c
> +++ b/drivers/gpu/drm/xe/xe_vm.c
> @@ -3101,9 +3101,9 @@ static int vm_bind_ioctl_check_args(struct xe_device *xe, struct xe_vm *vm,
>		if (!*bind_ops)
>			return args->num_binds > 1 ? -ENOBUFS : -ENOMEM;
>
> -		err = __copy_from_user(*bind_ops, bind_user,
> -				       sizeof(struct drm_xe_vm_bind_op) *
> -				       args->num_binds);
> +		err = copy_from_user(*bind_ops, bind_user,
> +				     sizeof(struct drm_xe_vm_bind_op) *
> +				     args->num_binds);
>		if (XE_IOCTL_DBG(xe, err)) {
>			err = -EFAULT;
>			goto free_bind_ops;
> --
> 2.48.1
>

  parent reply	other threads:[~2025-05-02  2:34 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-01 19:14 [PATCH 1/1] drm/xe: Use copy_from_user() instead of __copy_from_user() Harish Chegondi
2025-05-01 19:59 ` ✓ CI.Patch_applied: success for series starting with [1/1] " Patchwork
2025-05-01 19:59 ` ✓ CI.checkpatch: " Patchwork
2025-05-01 20:00 ` [PATCH 1/1] " Matthew Brost
2025-05-01 20:00 ` ✓ CI.KUnit: success for series starting with [1/1] " Patchwork
2025-05-01 20:09 ` ✓ CI.Build: " Patchwork
2025-05-01 20:11 ` ✓ CI.Hooks: " Patchwork
2025-05-01 20:12 ` ✓ CI.checksparse: " Patchwork
2025-05-01 23:50 ` ✗ Xe.CI.Full: failure " Patchwork
2025-05-02  2:34 ` Dixit, Ashutosh [this message]
2025-05-06  7:57 ` ✓ Xe.CI.BAT: success " Patchwork
2025-05-07  3:14 ` ✓ CI.Patch_applied: success for series starting with [1/1] drm/xe: Use copy_from_user() instead of __copy_from_user() (rev2) Patchwork
2025-05-07  3:14 ` ✓ CI.checkpatch: " Patchwork
2025-05-07  3:15 ` ✓ CI.KUnit: " Patchwork
2025-05-07  3:23 ` ✓ CI.Build: " Patchwork
2025-05-07  3:26 ` ✓ CI.Hooks: " Patchwork
2025-05-07  3:27 ` ✓ CI.checksparse: " Patchwork
2025-05-07  4:12 ` ✓ Xe.CI.BAT: " Patchwork
2025-05-07  6:00 ` ✗ Xe.CI.Full: failure " Patchwork
2025-05-26 16:51 ` ✗ CI.Patch_applied: " Patchwork

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=87y0vfspu4.wl-ashutosh.dixit@intel.com \
    --to=ashutosh.dixit@intel.com \
    --cc=harish.chegondi@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=kees@kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.