On Tue, 13 Jan 2026, Kaushlendra Kumar <[email protected]> wrote:
> 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 <[email protected]>
> ---
> v2: Fix include ordering, as per review
And what about the other *((const u32 *)(...)) etc. usages?
BR,
Jani.
>
> drivers/gpu/drm/i915/display/intel_bios.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/display/intel_bios.c
> b/drivers/gpu/drm/i915/display/intel_bios.c
> index 4b41068e9e35..a4c0f8a605c4 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.
> */
--
Jani Nikula, Intel