All of lore.kernel.org
 help / color / mirror / Atom feed
From: Rodrigo Vivi <rodrigo.vivi@intel.com>
To: Riana Tauro <riana.tauro@intel.com>
Cc: <intel-xe@lists.freedesktop.org>, <anshuman.gupta@intel.com>,
	<badal.nilawar@intel.com>, <jonathan.cavitt@intel.com>
Subject: Re: [PATCH v3 2/2] drm/xe/xe_survivability: Add index bound check
Date: Fri, 19 Dec 2025 10:59:26 -0500	[thread overview]
Message-ID: <aUV2Xk-2P1rze7bQ@intel.com> (raw)
In-Reply-To: <20251219105224.871930-6-riana.tauro@intel.com>

On Fri, Dec 19, 2025 at 04:22:27PM +0530, Riana Tauro wrote:
> Fix static analysis tool reported issue. Add index bound check before
> accessing info array to prevent out of bound.
> 
> Fixes: f4e9fc967afd ("drm/xe/xe_survivability: Redesign survivability mode")
> Signed-off-by: Riana Tauro <riana.tauro@intel.com>

Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>

> ---
>  drivers/gpu/drm/xe/xe_survivability_mode.c | 10 +++++++---
>  1 file changed, 7 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/xe/xe_survivability_mode.c b/drivers/gpu/drm/xe/xe_survivability_mode.c
> index e6e326dfb92b..ce55859a9a84 100644
> --- a/drivers/gpu/drm/xe/xe_survivability_mode.c
> +++ b/drivers/gpu/drm/xe/xe_survivability_mode.c
> @@ -258,10 +258,14 @@ static umode_t survivability_info_attrs_visible(struct kobject *kobj, struct att
>  	struct xe_survivability *survivability = &xe->survivability;
>  	u32 *info = survivability->info;
>  
> -	/* FDO mode is visible only when supported */
> -	if (idx >= MAX_SCRATCH_REG && survivability->version >= 2)
> +	/*
> +	 * Last index in survivability_info_attrs is fdo mode and is applicable only in
> +	 * version 2 of survivability mode
> +	 */
> +	if (idx == MAX_SCRATCH_REG && survivability->version >= 2)
>  		return 0400;
> -	else if (info[idx])
> +
> +	if (idx < MAX_SCRATCH_REG && info[idx])
>  		return 0400;
>  
>  	return 0;
> -- 
> 2.47.1
> 

  reply	other threads:[~2025-12-19 15:59 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-19 10:52 [PATCH v3 0/2] Survivability mode fixes Riana Tauro
2025-12-19 10:52 ` [PATCH v3 1/2] drm/xe/xe_survivability: Use static for survivability info attributes Riana Tauro
2025-12-19 15:57   ` Rodrigo Vivi
2025-12-19 10:52 ` [PATCH v3 2/2] drm/xe/xe_survivability: Add index bound check Riana Tauro
2025-12-19 15:59   ` Rodrigo Vivi [this message]
2025-12-19 11:11 ` ✓ CI.KUnit: success for Survivability mode fixes (rev3) Patchwork
2025-12-19 12:20 ` ✓ Xe.CI.BAT: " Patchwork
2025-12-20 13:25 ` ✗ Xe.CI.Full: failure " 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=aUV2Xk-2P1rze7bQ@intel.com \
    --to=rodrigo.vivi@intel.com \
    --cc=anshuman.gupta@intel.com \
    --cc=badal.nilawar@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=jonathan.cavitt@intel.com \
    --cc=riana.tauro@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 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.