From: Kaushlendra Kumar <kaushlendra.kumar@intel.com>
To: jani.nikula@linux.intel.com, rodrigo.vivi@intel.com,
joonas.lahtinen@linux.intel.com, tursulin@ursulin.net,
airlied@gmail.com, simona@ffwll.ch
Cc: intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org,
dri-devel@lists.freedesktop.org,
Kaushlendra Kumar <kaushlendra.kumar@intel.com>
Subject: [PATCH v3] drm/i915/bios: Use get_unaligned_* for VBT block size
Date: Wed, 14 Jan 2026 08:31:45 +0530 [thread overview]
Message-ID: <20260114030145.3039094-1-kaushlendra.kumar@intel.com> (raw)
Replace pointer casts with get_unaligned_* helpers for VBT
block size reads. This ensures endianness and alignment
correctness in VBT parsing.
Signed-off-by: Kaushlendra Kumar <kaushlendra.kumar@intel.com>
---
v2: Fix include ordering, as per review
v3: Update all instances in file, not just _get_blocksize
drivers/gpu/drm/i915/display/intel_bios.c | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/drivers/gpu/drm/i915/display/intel_bios.c b/drivers/gpu/drm/i915/display/intel_bios.c
index 4b41068e9e35..91286fafa52b 100644
--- a/drivers/gpu/drm/i915/display/intel_bios.c
+++ b/drivers/gpu/drm/i915/display/intel_bios.c
@@ -27,6 +27,7 @@
#include <linux/debugfs.h>
#include <linux/firmware.h>
+#include <linux/unaligned.h>
#include <drm/display/drm_dp_helper.h>
#include <drm/display/drm_dsc_helper.h>
@@ -85,9 +86,9 @@ static u32 _get_blocksize(const u8 *block_base)
{
/* The MIPI Sequence Block v3+ has a separate size field. */
if (*block_base == BDB_MIPI_SEQUENCE && *(block_base + 3) >= 3)
- return *((const u32 *)(block_base + 4));
+ return get_unaligned_le32(block_base + 4);
else
- return *((const u16 *)(block_base + 1));
+ return get_unaligned_le16(block_base + 1);
}
/* Get BDB block size give a pointer to data after Block ID and Block Size. */
@@ -1791,9 +1792,9 @@ find_panel_sequence_block(struct intel_display *display,
current_id = *(data + index);
if (sequence->version >= 3)
- current_size = *((const u32 *)(data + index + 1));
+ current_size = get_unaligned_le32(data + index + 1);
else
- current_size = *((const u16 *)(data + index + 1));
+ current_size = get_unaligned_le16(data + index + 1);
index += header_size;
@@ -1833,7 +1834,7 @@ static int goto_next_sequence(struct intel_display *display,
if (index + 4 > total)
return 0;
- len = *((const u16 *)(data + index + 2)) + 4;
+ len = get_unaligned_le16(data + index + 2) + 4;
break;
case MIPI_SEQ_ELEM_DELAY:
len = 4;
@@ -1879,7 +1880,7 @@ static int goto_next_sequence_v3(struct intel_display *display,
* includes MIPI_SEQ_ELEM_END byte, excludes the final MIPI_SEQ_END
* byte.
*/
- size_of_sequence = *((const u32 *)(data + index));
+ size_of_sequence = get_unaligned_le32(data + index);
index += 4;
seq_end = index + size_of_sequence;
--
2.34.1
next reply other threads:[~2026-01-14 3:04 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-14 3:01 Kaushlendra Kumar [this message]
2026-01-14 3:11 ` ✓ CI.KUnit: success for drm/i915/bios: Use get_unaligned_* for VBT block size (rev3) Patchwork
2026-01-14 3:45 ` ✓ Xe.CI.BAT: " Patchwork
2026-01-14 11:11 ` ✓ Xe.CI.Full: " Patchwork
2026-01-14 11:55 ` [PATCH v3] drm/i915/bios: Use get_unaligned_* for VBT block size Jani Nikula
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=20260114030145.3039094-1-kaushlendra.kumar@intel.com \
--to=kaushlendra.kumar@intel.com \
--cc=airlied@gmail.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=intel-gfx@lists.freedesktop.org \
--cc=intel-xe@lists.freedesktop.org \
--cc=jani.nikula@linux.intel.com \
--cc=joonas.lahtinen@linux.intel.com \
--cc=rodrigo.vivi@intel.com \
--cc=simona@ffwll.ch \
--cc=tursulin@ursulin.net \
/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