Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Gustavo Sousa <gustavo.sousa@intel.com>
To: <sashiko-reviews@lists.linux.dev>,
	Michal Wajdeczko <michal.wajdeczko@intel.com>
Cc: <intel-xe@lists.freedesktop.org>
Subject: Re: [PATCH 2/6] drm/xe: Keep reference to device descriptor
Date: Sat, 5 Sep 2026 10:52:02 -0300	[thread overview]
Message-ID: <874ig3956l.fsf@intel.com> (raw)
In-Reply-To: <20260904171419.E21DF1F00A3D@smtp.kernel.org>

sashiko-bot@kernel.org writes:

> Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
> - [Medium] In test initialization, `xe->subplatform_desc` is incorrectly assigned a pointer to a sentinel element instead of `NULL` when no subplatform is matched.
> --
>
> commit 2fbc7ea3deaa915eef829a4c64ec08fac1f4a8a9
> Author: Michal Wajdeczko <michal.wajdeczko@intel.com>
>
> drm/xe: Keep reference to device descriptor
>
> This patch stores a reference to the whole device descriptor and the
> matched subplatform descriptor within the xe_device structure. This
> change enables access to additional non-mutable device parameters.
>
>> diff --git a/drivers/gpu/drm/xe/tests/xe_pci.c b/drivers/gpu/drm/xe/tests/xe_pci.c
>> index 4965a01f6ba52..48d5ee478fe69 100644
>> --- a/drivers/gpu/drm/xe/tests/xe_pci.c
>> +++ b/drivers/gpu/drm/xe/tests/xe_pci.c
>> @@ -374,6 +374,8 @@ int xe_pci_fake_device_init(struct xe_device *xe)
>>  		return -ENODEV;
>>  
>>  done:
>> +	xe->desc = desc;
>> +	xe->subplatform_desc = subplatform_desc;
>
> [Severity: Medium]
> Will this assign a pointer to a sentinel element instead of NULL when no
> subplatform is matched?
>
> In xe_pci_fake_device_init(), the search loop terminates when it reaches the
> sentinel element:
>
> 	for (subplatform_desc = desc->subplatforms;
> 	     subplatform_desc && subplatform_desc->subplatform;
> 	     subplatform_desc++)
> 		if (subplatform_desc->subplatform == data->subplatform)
> 			break;
>
> If data->subplatform is XE_SUBPLATFORM_NONE, the loop exits with
> subplatform_desc pointing to the sentinel element of desc->subplatforms, not
> NULL. The subsequent check (!subplatform_desc) evaluates to false.
>
> By directly assigning this value to xe->subplatform_desc, the test mock
> environment now gets a non-NULL pointer (the sentinel) for devices without a
> subplatform. Could this create a state inconsistency with production code,
> causing tests checking if (xe->subplatform_desc) to falsely evaluate to
> true?

Sashiko seems to be right here. I think we could initialize
subplatform_desc to NULL and assign the one from the loop if we find a
match.

--
Gustavo Sousa

>
> -- 
> Sashiko AI review · https://sashiko.dev/#/patchset/20260904170531.516-1-michal.wajdeczko@intel.com?part=2

  reply	other threads:[~2026-09-05 13:52 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-04 17:05 [PATCH 0/6] drm/xe/log: Relax location ID recognition Michal Wajdeczko
2026-09-04 17:05 ` [PATCH 1/6] drm/xe: Drop unused parameter from xe_info_init Michal Wajdeczko
2026-09-04 18:09   ` Rodrigo Vivi
2026-09-05 13:04   ` Gustavo Sousa
2026-09-04 17:05 ` [PATCH 2/6] drm/xe: Keep reference to device descriptor Michal Wajdeczko
2026-09-04 17:14   ` sashiko-bot
2026-09-05 13:52     ` Gustavo Sousa [this message]
2026-09-07 19:30       ` Michal Wajdeczko
2026-09-11 11:25         ` Michal Wajdeczko
2026-09-11 16:36           ` Gustavo Sousa
2026-09-04 17:05 ` [PATCH 3/6] drm/xe: Drop redundant parameters from xe_info_init_early Michal Wajdeczko
2026-09-05 13:54   ` Gustavo Sousa
2026-09-04 17:05 ` [PATCH 4/6] drm/xe: Drop redundant parameter from xe_probe_info_early Michal Wajdeczko
2026-09-05 13:55   ` Gustavo Sousa
2026-09-04 17:05 ` [PATCH 5/6] drm/xe: Drop redundant parameter from xe_probe_info and friends Michal Wajdeczko
2026-09-05 13:58   ` Gustavo Sousa
2026-09-04 17:05 ` [PATCH 6/6] drm/xe/log: Relax location ID recognition Michal Wajdeczko
2026-09-04 18:44   ` Rodrigo Vivi
2026-09-09  9:00   ` Mallesh, Koujalagi
2026-09-09  9:42     ` Michal Wajdeczko
2026-09-09 11:02       ` Mallesh, Koujalagi
2026-09-09 13:01         ` Michal Wajdeczko
2026-09-04 17:13 ` ✓ CI.KUnit: success for " Patchwork
2026-09-04 17:52 ` ✓ Xe.CI.BAT: " Patchwork
2026-09-05  1:36 ` ✓ Xe.CI.FULL: " 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=874ig3956l.fsf@intel.com \
    --to=gustavo.sousa@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=michal.wajdeczko@intel.com \
    --cc=sashiko-reviews@lists.linux.dev \
    /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