Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Nirmoy Das <nirmoy.das@linux.intel.com>
To: Matthew Auld <matthew.auld@intel.com>, intel-xe@lists.freedesktop.org
Cc: Stuart Summers <stuart.summers@intel.com>,
	Matthew Brost <matthew.brost@intel.com>
Subject: Re: [PATCH] drm/xe: fixup xe_alloc_pf_queue
Date: Wed, 21 Aug 2024 20:15:12 +0200	[thread overview]
Message-ID: <5054f198-9819-45af-ad17-0bf22b12e3ad@linux.intel.com> (raw)
In-Reply-To: <20240821171917.417386-2-matthew.auld@intel.com>

[-- Attachment #1: Type: text/plain, Size: 1438 bytes --]


On 8/21/2024 7:19 PM, Matthew Auld wrote:
> kzalloc expects number of bytes, therefore we should convert the number
> of dw into bytes, otherwise we are likely just accessing beyond the
> array causing all kinds of carnage. Also fixup the error handling while
> we are here.
>
> Fixes: 3338e4f90c14 ("drm/xe: Use topology to determine page fault queue size")
> Signed-off-by: Matthew Auld<matthew.auld@intel.com>
> Cc: Stuart Summers<stuart.summers@intel.com>
> Cc: Matthew Brost<matthew.brost@intel.com>

Nice catch, I was staring at 3338e4f90c14 for a while. We should get 
this merged soon.

Reviewed-by: Nirmoy Das <nirmoy.das@intel.com>


> ---
>   drivers/gpu/drm/xe/xe_gt_pagefault.c | 5 ++++-
>   1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/xe/xe_gt_pagefault.c b/drivers/gpu/drm/xe/xe_gt_pagefault.c
> index 401c0527d914..e4510e56e4a2 100644
> --- a/drivers/gpu/drm/xe/xe_gt_pagefault.c
> +++ b/drivers/gpu/drm/xe/xe_gt_pagefault.c
> @@ -417,7 +417,10 @@ static int xe_alloc_pf_queue(struct xe_gt *gt, struct pf_queue *pf_queue)
>   		(num_eus + XE_NUM_HW_ENGINES) * PF_MSG_LEN_DW;
>   
>   	pf_queue->gt = gt;
> -	pf_queue->data = kzalloc(pf_queue->num_dw, GFP_KERNEL);
> +	pf_queue->data = kzalloc(pf_queue->num_dw * sizeof(u32), GFP_KERNEL);
> +	if (!pf_queue->data)
> +		return -ENOMEM;
> +
>   	spin_lock_init(&pf_queue->lock);
>   	INIT_WORK(&pf_queue->worker, pf_queue_work_func);
>   

[-- Attachment #2: Type: text/html, Size: 2345 bytes --]

  parent reply	other threads:[~2024-08-21 18:15 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-21 17:19 [PATCH] drm/xe: fixup xe_alloc_pf_queue Matthew Auld
2024-08-21 17:46 ` ✓ CI.Patch_applied: success for " Patchwork
2024-08-21 17:47 ` ✗ CI.checkpatch: warning " Patchwork
2024-08-21 17:48 ` ✓ CI.KUnit: success " Patchwork
2024-08-21 17:59 ` ✓ CI.Build: " Patchwork
2024-08-21 18:02 ` ✓ CI.Hooks: " Patchwork
2024-08-21 18:03 ` ✓ CI.checksparse: " Patchwork
2024-08-21 18:15 ` Nirmoy Das [this message]
2024-08-21 18:23 ` ✓ CI.BAT: " Patchwork
2024-08-21 23:54 ` ✗ CI.FULL: failure " Patchwork
2024-08-22  2:49 ` [PATCH] " Matthew Brost
2024-08-22  8:54   ` Matthew Auld

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=5054f198-9819-45af-ad17-0bf22b12e3ad@linux.intel.com \
    --to=nirmoy.das@linux.intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=matthew.auld@intel.com \
    --cc=matthew.brost@intel.com \
    --cc=stuart.summers@intel.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