intel-xe.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Michał Grzelak" <michal.grzelak@intel.com>
Cc: intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org
Subject: Re: [PATCH v12 4/8] drm/i915/bios: de/allocate VS/PE-O buffers for each port
Date: Fri, 04 Sep 2026 12:46:34 +0000	[thread overview]
Message-ID: <20260904124635.6CEDD1F00A3E@smtp.kernel.org> (raw)
In-Reply-To: <20260904123148.2165596-5-michal.grzelak@intel.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Missing validation for `num_rows` allows allocation of a zero-length override buffer, leading to ZERO_SIZE_PTR bypass and potential out-of-bounds array access.
--

commit 8e0ea30f286f43a0a8c7581e1d9abc3a9fc3887e
Author: Michał Grzelak <michal.grzelak@intel.com>

drm/i915/bios: de/allocate VS/PE-O buffers for each port

Every devdata needs VS/PE-O dedicated buffers since each port can
request an override. Add intel_ddi_buf_trans{,_entry} pointers into
intel_bios_encoder_data and allocate/free them for the port if requested.

> diff --git a/drivers/gpu/drm/i915/display/intel_bios.c b/drivers/gpu/drm/i915/display/intel_bios.c
> index 9610b794bc147..1a09f7933e491 100644
> --- a/drivers/gpu/drm/i915/display/intel_bios.c
> +++ b/drivers/gpu/drm/i915/display/intel_bios.c
[ ... ]
> @@ -2648,6 +2651,30 @@ static void sanitize_device_type(struct intel_bios_encoder_data *devdata,
>  	devdata->child.device_type |= DEVICE_TYPE_NOT_HDMI_OUTPUT;
>  }
>  
> +static void allocate_vswing_preemph_override(struct intel_bios_encoder_data *devdata)
> +{
> +	int num_rows = devdata->display->vbt.vspeo.num_rows;
> +	union intel_ddi_buf_trans_entry *entries;
> +	struct intel_ddi_buf_trans *vspeo;
> +
> +	if (!intel_bios_encoder_requests_vspeo(devdata))
> +		return;
> +
> +	vspeo = kzalloc_obj(*vspeo);
> +	if (!vspeo)
> +		return;
> +
> +	entries = kzalloc_objs(*entries, num_rows);
> +	if (!entries) {

[Severity: High]
If a system provides a malformed VBT where use_vbt_vswing is true but the
BDB_VSWING_PREEMPH block is missing, could num_rows be 0 here?

When num_rows is 0, kzalloc_objs() returns ZERO_SIZE_PTR. Because
ZERO_SIZE_PTR is not NULL, it bypasses this !entries check.

This results in the creation of a zero-entry table that signals to
downstream code that override data is present. Later, when this table is
fetched by intel_ddi_buf_trans_get() and passed to intel_ddi_level(),
the index is clamped to n_entries - 1 (yielding -1).

Could this lead to an out-of-bounds memory read relative to ZERO_SIZE_PTR
when the caller accesses trans->entries[-1]?

> +		kfree(vspeo);
> +		return;
> +	}
> +
> +	devdata->entries = entries;
> +	devdata->vspeo = vspeo;
> +	devdata->vspeo->num_entries = num_rows;
> +}
> +

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260904123148.2165596-1-michal.grzelak@intel.com?part=4

  reply	other threads:[~2026-09-04 12:46 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-04 12:31 [PATCH v12 0/8] Vswing / Pre-emphasis Override Michał Grzelak
2026-09-04 12:31 ` [PATCH v12 1/8] drm/i915/bios: search for VBT #57 by default Michał Grzelak
2026-09-04 12:31 ` [PATCH v12 2/8] drm/i915/bios: store VBT #57's metadata in intel_vbt_data Michał Grzelak
2026-09-04 12:43   ` sashiko-bot
2026-09-04 12:31 ` [PATCH v12 3/8] drm/i915/bios: print VS/PE-O port info Michał Grzelak
2026-09-04 12:50   ` sashiko-bot
2026-09-04 12:31 ` [PATCH v12 4/8] drm/i915/bios: de/allocate VS/PE-O buffers for each port Michał Grzelak
2026-09-04 12:46   ` sashiko-bot [this message]
2026-09-04 12:31 ` [PATCH v12 5/8] drm/i915/buf_trans: add vfunc for VS/PE-O Michał Grzelak
2026-09-04 12:31 ` [PATCH v12 6/8] drm/i915: override Snps's VS/PE when requested Michał Grzelak
2026-09-04 12:53   ` sashiko-bot
2026-09-04 12:31 ` [PATCH v12 7/8] drm/i915: override Combo's " Michał Grzelak
2026-09-04 12:59   ` sashiko-bot
2026-09-07 12:27   ` [PATCH v13 " Michał Grzelak
2026-09-04 12:31 ` [PATCH v12 8/8] drm/i915/bios: remove VS/PE-O warning Michał Grzelak
2026-09-04 13:04 ` ✗ CI.checkpatch: warning for Vswing / Pre-emphasis Override (rev7) Patchwork
2026-09-04 13:06 ` ✓ CI.KUnit: success " Patchwork
2026-09-04 14:06 ` ✓ Xe.CI.BAT: " Patchwork
2026-09-04 23:39 ` ✗ Xe.CI.FULL: failure " Patchwork
2026-09-07 13:17 ` ✗ CI.checkpatch: warning for Vswing / Pre-emphasis Override (rev8) Patchwork
2026-09-07 13:19 ` ✓ CI.KUnit: success " Patchwork
2026-09-07 14:00 ` ✓ Xe.CI.BAT: " Patchwork
2026-09-07 15:50 ` ✓ Xe.CI.FULL: " Patchwork
2026-09-08  4:33 ` [PATCH v12 0/8] Vswing / Pre-emphasis Override Kandpal, Suraj

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=20260904124635.6CEDD1F00A3E@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=michal.grzelak@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;
as well as URLs for NNTP newsgroup(s).