From: Rodrigo Vivi <rodrigo.vivi@intel.com>
To: Himal Prasad Ghimiray <himal.prasad.ghimiray@intel.com>
Cc: <intel-xe@lists.freedesktop.org>
Subject: Re: [PATCH v2] drm/xe/xe_migrate: Cast to output precision before multiplying operands
Date: Wed, 3 Apr 2024 15:02:37 -0400 [thread overview]
Message-ID: <Zg2nzUDwHGXBECj3@intel.com> (raw)
In-Reply-To: <20240401175300.3823653-1-himal.prasad.ghimiray@intel.com>
On Mon, Apr 01, 2024 at 11:23:00PM +0530, Himal Prasad Ghimiray wrote:
> Addressing potential overflow in result of multiplication of two lower
> precision (u32) operands before widening it to higher precision
> (u64).
>
> -v2
> Fix commit message and description. (Rodrigo)
>
> Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
> Signed-off-by: Himal Prasad Ghimiray <himal.prasad.ghimiray@intel.com>
Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
pushing soon...
> ---
> drivers/gpu/drm/xe/xe_migrate.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/xe/xe_migrate.c b/drivers/gpu/drm/xe/xe_migrate.c
> index ee1bb938c493..2ba4fb9511f6 100644
> --- a/drivers/gpu/drm/xe/xe_migrate.c
> +++ b/drivers/gpu/drm/xe/xe_migrate.c
> @@ -227,7 +227,7 @@ static int xe_migrate_prepare_vm(struct xe_tile *tile, struct xe_migrate *m,
> if (vm->flags & XE_VM_FLAG_64K && level == 1)
> flags = XE_PDE_64K;
>
> - entry = vm->pt_ops->pde_encode_bo(bo, map_ofs + (level - 1) *
> + entry = vm->pt_ops->pde_encode_bo(bo, map_ofs + (u64)(level - 1) *
> XE_PAGE_SIZE, pat_index);
> xe_map_wr(xe, &bo->vmap, map_ofs + XE_PAGE_SIZE * level, u64,
> entry | flags);
> @@ -235,7 +235,7 @@ static int xe_migrate_prepare_vm(struct xe_tile *tile, struct xe_migrate *m,
>
> /* Write PDE's that point to our BO. */
> for (i = 0; i < num_entries - num_level; i++) {
> - entry = vm->pt_ops->pde_encode_bo(bo, i * XE_PAGE_SIZE,
> + entry = vm->pt_ops->pde_encode_bo(bo, (u64)i * XE_PAGE_SIZE,
> pat_index);
>
> xe_map_wr(xe, &bo->vmap, map_ofs + XE_PAGE_SIZE +
> @@ -291,7 +291,7 @@ static int xe_migrate_prepare_vm(struct xe_tile *tile, struct xe_migrate *m,
> #define VM_SA_UPDATE_UNIT_SIZE (XE_PAGE_SIZE / NUM_VMUSA_UNIT_PER_PAGE)
> #define NUM_VMUSA_WRITES_PER_UNIT (VM_SA_UPDATE_UNIT_SIZE / sizeof(u64))
> drm_suballoc_manager_init(&m->vm_update_sa,
> - (map_ofs / XE_PAGE_SIZE - NUM_KERNEL_PDE) *
> + (size_t)(map_ofs / XE_PAGE_SIZE - NUM_KERNEL_PDE) *
> NUM_VMUSA_UNIT_PER_PAGE, 0);
>
> m->pt_bo = bo;
> @@ -490,7 +490,7 @@ static void emit_pte(struct xe_migrate *m,
> struct xe_vm *vm = m->q->vm;
> u16 pat_index;
> u32 ptes;
> - u64 ofs = at_pt * XE_PAGE_SIZE;
> + u64 ofs = (u64)at_pt * XE_PAGE_SIZE;
> u64 cur_ofs;
>
> /* Indirect access needs compression enabled uncached PAT index */
> --
> 2.25.1
>
next prev parent reply other threads:[~2024-04-03 19:03 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-01 17:53 [PATCH v2] drm/xe/xe_migrate: Cast to output precision before multiplying operands Himal Prasad Ghimiray
2024-04-01 18:12 ` ✓ CI.Patch_applied: success for " Patchwork
2024-04-01 18:12 ` ✓ CI.checkpatch: " Patchwork
2024-04-01 18:13 ` ✓ CI.KUnit: " Patchwork
2024-04-01 18:25 ` ✓ CI.Build: " Patchwork
2024-04-01 18:27 ` ✓ CI.Hooks: " Patchwork
2024-04-01 18:29 ` ✓ CI.checksparse: " Patchwork
2024-04-01 19:05 ` ✓ CI.BAT: " Patchwork
2024-04-03 19:02 ` Rodrigo Vivi [this message]
-- strict thread matches above, loose matches on Subject: below --
2024-04-01 17:52 [PATCH v2] " Himal Prasad Ghimiray
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=Zg2nzUDwHGXBECj3@intel.com \
--to=rodrigo.vivi@intel.com \
--cc=himal.prasad.ghimiray@intel.com \
--cc=intel-xe@lists.freedesktop.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.