The branch main has been updated by olce:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=53bb02015fce72c79498842b898faefc2da3b0fb

commit 53bb02015fce72c79498842b898faefc2da3b0fb
Author:     Olivier Certner <[email protected]>
AuthorDate: 2026-01-30 17:33:12 +0000
Commit:     Olivier Certner <[email protected]>
CommitDate: 2026-02-03 17:19:00 +0000

    amd64: parse_memmap(): Move comment about size at proper place
    
    While here, declare 'size' only in the relevant block.
    
    No functional change (intended).
    
    MFC after:      1 week
    Sponsored by:   The FreeBSD Foundation
---
 sys/amd64/amd64/machdep.c | 19 +++++++++----------
 1 file changed, 9 insertions(+), 10 deletions(-)

diff --git a/sys/amd64/amd64/machdep.c b/sys/amd64/amd64/machdep.c
index e56de986ccba..ae5df475f046 100644
--- a/sys/amd64/amd64/machdep.c
+++ b/sys/amd64/amd64/machdep.c
@@ -827,15 +827,6 @@ native_parse_memmap(vm_paddr_t *physmap, int *physmap_idx)
 {
        struct bios_smap *smap;
        struct efi_map_header *efihdr;
-       u_int32_t size;
-
-       /*
-        * Memory map from INT 15:E820.
-        *
-        * subr_module.c says:
-        * "Consumer may safely assume that size value precedes data."
-        * ie: an int32_t immediately precedes smap.
-        */
 
        efihdr = (struct efi_map_header *)preload_search_info(preload_kmdp,
            MODINFO_METADATA | MODINFOMD_EFI_MAP);
@@ -848,7 +839,15 @@ native_parse_memmap(vm_paddr_t *physmap, int *physmap_idx)
                add_efi_map_entries(efihdr, physmap, physmap_idx);
                strlcpy(bootmethod, "UEFI", sizeof(bootmethod));
        } else {
-               size = *((u_int32_t *)smap - 1);
+               /*
+                * Memory map from INT 15:E820.
+                *
+                * subr_module.c says:
+                * "Consumer may safely assume that size value precedes data."
+                * ie: an int32_t immediately precedes smap.
+                */
+               u_int32_t size = *((u_int32_t *)smap - 1);
+
                bios_add_smap_entries(smap, size, physmap, physmap_idx);
                strlcpy(bootmethod, "BIOS", sizeof(bootmethod));
        }

Reply via email to