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]>
> ---
>  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..dd1b3f629428 100644
> --- a/drivers/gpu/drm/i915/display/intel_bios.c
> +++ b/drivers/gpu/drm/i915/display/intel_bios.c
> @@ -45,6 +45,7 @@
>  
>  #define _INTEL_BIOS_PRIVATE
>  #include "intel_vbt_defs.h"
> +#include <linux/unaligned.h>

Please put the include next to other linux/ includes, sorted.

>  
>  /**
>   * DOC: Video BIOS Table (VBT)
> @@ -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);

There's a handful of other places in the file that could use the same
treatment.

BR,
Jani.

>  }
>  
>  /* Get BDB block size give a pointer to data after Block ID and Block Size. 
> */

-- 
Jani Nikula, Intel

Reply via email to