[Bug 264021] efi: failed to allocate staging area: 9

From: <bugzilla-noreply_at_freebsd.org>
Date: Fri, 20 May 2022 21:04:16 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=264021

Jessica Clarke <jrtc27@freebsd.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jrtc27@freebsd.org

--- Comment #8 from Jessica Clarke <jrtc27@freebsd.org> ---
I doubt efihdr is the problem. It's likely that the call to BS->GetMemoryMap
the first time round the loop, which is guaranteed to be executed, reads an
uninitialised mm, and thus we have trivially provably guaranteed UB ("The value
of an object with automatic storage duration is used while it is
indeterminate"). What value it takes doesn't matter as the first time round the
loop we use sz = 0 so, unless the memory map has 0 entries, it's guaranteed to
fit, but it must be initialised to something determinate.

Minimal-ish reproducer: https://godbolt.org/z/KTvd73osd

-- 
You are receiving this mail because:
You are the assignee for the bug.