From: sashiko-bot@kernel.org
To: "Michał Grzelak" <michal.grzelak@intel.com>
Cc: intel-xe@lists.freedesktop.org, intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH v1 04/16] drm/i915/bios: prepare for parsing VBT #57
Date: Thu, 13 Aug 2026 23:12:35 +0000 [thread overview]
Message-ID: <20260813231236.52D061F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260331183332.1773886-5-michal.grzelak@intel.com>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] Missing NULL check on `kzalloc` causing NULL pointer dereference.
- [High] Unconditional memory leak of `bufs_table` and its elements.
--
--- Patch [4]: [PATCH v1 04/16] drm/i915/bios: prepare for parsing VBT #57 ---
commit a6241aaaf22342914933a8b58de0747a6e01cf2a
Author: Michał Grzelak <michal.grzelak@intel.com>
drm/i915/bios: prepare for parsing VBT #57
This commit adds parsing code for VBT #57 and a structure for storing VS/PE
data. It also allocates a matrix of intel_ddi_buf_trans_entry to store the
deparsed values and handles its deallocation on driver removal.
> diff --git a/drivers/gpu/drm/i915/display/intel_bios.c b/drivers/gpu/drm/i915/display/intel_bios.c
> index b6fe87c29aa7c..778584c59fc6f 100644
> --- a/drivers/gpu/drm/i915/display/intel_bios.c
> +++ b/drivers/gpu/drm/i915/display/intel_bios.c
[ ... ]
> @@ -2183,6 +2184,38 @@ parse_compression_parameters(struct intel_display *display)
> }
> }
>
> +static void
> +parse_vswing_preemph_override(struct intel_display *display)
> +{
> + union intel_ddi_buf_trans_entry **bufs_table;
> + const struct bdb_vswing_preemph *block;
> + u8 num_rows;
> +
> + if (display->vbt.version < 218)
> + return;
> +
> + block = bdb_find_section(display, BDB_VSWING_PREEMPH);
> +
> + /* pre-ICL GOP don't have VBT #57 */
> + if (!block)
> + return;
> +
> + num_rows = DISPLAY_VER(display) >= 14 ? 16 : 10;
> +
> + bufs_table = kzalloc(block->num_tables * sizeof(*bufs_table), GFP_KERNEL);
> +
> + for (int idx = 0; idx < block->num_tables; idx++)
> + bufs_table[idx] = kzalloc(num_rows * sizeof(**bufs_table), GFP_KERNEL);
[Severity: High]
Is a NULL check missing here?
If kzalloc() fails to allocate bufs_table, the loop will immediately attempt
to assign to bufs_table[idx] and cause a NULL pointer dereference.
Additionally, if the inner kzalloc() for individual rows fails, it leaves
NULL pointers in the table without any error handling.
> +
> + drm_dbg_kms(display->drm, "Vswing / Preemph Override not yet supported on the platform\n");
> + bufs_table = NULL;
[Severity: High]
Does this cause an unconditional memory leak?
The memory just allocated for bufs_table and its elements is explicitly
overwritten with NULL here.
This causes display->vbt.vswing_preemph.bufs_table to receive NULL, and the
original allocated pointers are completely lost, preventing them from being
freed during intel_bios_driver_remove().
> +
> + display->vbt.vswing_preemph.bufs_table = bufs_table;
> + display->vbt.vswing_preemph.num_tables = block->num_tables;
> + display->vbt.vswing_preemph.num_rows = num_rows;
> + display->vbt.vswing_preemph.num_cols = block->num_columns;
> +}
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260331183332.1773886-1-michal.grzelak@intel.com?part=4
next prev parent reply other threads:[~2026-08-13 23:12 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-31 18:33 [PATCH v1 00/16] VS/PE Override support Michał Grzelak
2026-03-31 18:33 ` [PATCH v1 01/16] drm/i915/lt: align xe3plpd with VS/PE Override layout Michał Grzelak
2026-03-31 18:33 ` [PATCH v1 02/16] drm/i915/buf_trans: switch from u8 to u32 Michał Grzelak
2026-03-31 18:33 ` [PATCH v1 03/16] drm/i915/buf_trans: describe VS/PE Override layout Michał Grzelak
2026-03-31 18:33 ` [PATCH v1 04/16] drm/i915/bios: prepare for parsing VBT #57 Michał Grzelak
2026-08-13 23:12 ` sashiko-bot [this message]
2026-03-31 18:33 ` [PATCH v1 05/16] drm/i915/bios: parse LT's VS/PE Override Block #57 Michał Grzelak
2026-03-31 18:33 ` [PATCH v1 06/16] drm/i915/bios: parse Snps's " Michał Grzelak
2026-03-31 18:33 ` [PATCH v1 07/16] drm/i915/bios: parse EHL's " Michał Grzelak
2026-03-31 18:33 ` [PATCH v1 08/16] drm/i915/bios: support VS/PE Override per each ddi port Michał Grzelak
2026-04-03 8:39 ` kernel test robot
2026-03-31 18:33 ` [PATCH v1 09/16] drm/i915/bios: print VS/PE Override port info Michał Grzelak
2026-03-31 18:33 ` [PATCH v1 10/16] drm/i915/ddi: cache VS/PE struct pointer into intel_encoder Michał Grzelak
2026-03-31 18:33 ` [PATCH v1 11/16] drm/i915/buf_trans: override encoder->get_buf_trans when asked Michał Grzelak
2026-03-31 18:33 ` [PATCH v1 12/16] drm/i915/buf_trans: compute LT's VS/PE Override index Michał Grzelak
2026-04-01 7:16 ` kernel test robot
2026-03-31 18:33 ` [PATCH v1 13/16] drm/i915/buf_trans: compute Snps's " Michał Grzelak
2026-03-31 18:33 ` [PATCH v1 14/16] drm/i915/buf_trans: compute EHL's " Michał Grzelak
2026-03-31 18:33 ` [PATCH v1 15/16] drm/i915/bios: search for VBT #57 by default Michał Grzelak
2026-04-15 6:42 ` kernel test robot
2026-04-16 6:40 ` [LTP] " Petr Vorel
2026-04-16 7:40 ` Oliver Sang
2026-04-16 9:17 ` Michał Grzelak
2026-04-17 17:11 ` Petr Vorel
2026-03-31 18:33 ` [PATCH v1 16/16] drm/i915/bios: remove VS/PE Override warning Michał Grzelak
2026-03-31 19:47 ` ✗ i915.CI.BAT: failure for VS/PE Override support 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=20260813231236.52D061F000E9@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