Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

partition: fix unaligned access in load_mbr_header() #9

Open
wants to merge 1 commit into
base: mtksoc
Choose a base branch
from

Commits on Jun 7, 2024

  1. partition: fix unaligned access in load_mbr_header()

    load_mbr_header() casts an unaligned pointer to (mbr_entry_t *) then
    dereferences struct members with non-trivial alignment requirements.
    
    This causes a bl2 with BOOT_DEVICE=emmc to hang when compiled with clang
    18.1.5, although it works when compiled with gcc 14.1.0. Presumably gcc's
    -mstrict-align papers over the undefined behaviour whereas clang's doesn't.
    
    Replace the unaligned cast with a safe memcpy() into an mbr_entry_t.
    
    Signed-off-by: Chris Webb <chris@arachsys.com>
    arachsys committed Jun 7, 2024
    Configuration menu
    Copy the full SHA
    255c22c View commit details
    Browse the repository at this point in the history