Branch: refs/heads/master
Home: https://github.com/tianocore/edk2
Commit: 52f19aacd569aa0f1f264108ed518a96657f9088
https://github.com/tianocore/edk2/commit/52f19aacd569aa0f1f264108ed518a96657f9088
Author: Mingjie Shen <[email protected]>
Date: 2026-09-03 (Thu, 03 Sep 2026)
Changed paths:
M BaseTools/Source/C/GenSec/GenSec.c
Log Message:
-----------
BaseTools/GenSec: Use SECTION_SIZE to read section size
Replace the open-coded read of the 3-byte section Size[] field with
the SECTION_SIZE() macro from Pi/PiFirmwareFile.h. The macro reads
exactly the three Size[] bytes (endianness-safe) instead of a 4-byte
load that over-reads the adjacent byte. No functional change.
Verified by building BaseTools and running GenSec:
python3 BaseTools/Edk2ToolsBuild.py -t GCC
GenSec -s EFI_SECTION_RAW -o out.sec in.bin # in.bin: 100 bytes
out.sec is 104 bytes: the 100-byte payload plus the 4-byte
EFI_COMMON_SECTION_HEADER. The Size field of the header reads
0x000068, matching out.sec's size that is calculated by SECTION_SIZE.
Generated with the following Coccinelle semantic patch:
```smpl
@@
EFI_COMMON_SECTION_HEADER *E;
typedef UINT32;
@@
(
- *(UINT32 *)(E->Size) & 0x00FFFFFF
+ SECTION_SIZE (E)
|
- *(UINT32 *)E->Size & 0x00FFFFFF
+ SECTION_SIZE (E)
)
```
Signed-off-by: Mingjie Shen <[email protected]>
Commit: 76132a56892aa3178697d958991ac4d129cb7042
https://github.com/tianocore/edk2/commit/76132a56892aa3178697d958991ac4d129cb7042
Author: Mingjie Shen <[email protected]>
Date: 2026-09-03 (Thu, 03 Sep 2026)
Changed paths:
M OvmfPkg/LoongArchVirt/Sec/SecMain.c
Log Message:
-----------
OvmfPkg/LoongArchVirt: Use FFS_FILE_SIZE to read FFS file size
Replace the open-coded read of the 3-byte FFS file Size[] field in
FindFfsFileAndSection() with the FFS_FILE_SIZE() macro from
Pi/PiFirmwareFile.h. The macro reads exactly the three Size[] bytes
(endianness-safe) instead of a 4-byte load that over-reads the
adjacent byte. No functional change.
Verified by building the module for LOONGARCH64 with a GCC cross
toolchain:
build -p OvmfPkg/LoongArchVirt/LoongArchVirtQemu.dsc -a LOONGARCH64 \
-t GCC -b DEBUG -m OvmfPkg/LoongArchVirt/Sec/SecMain.inf
SecMain.c compiles and links into SecMain.efi.
Generated with the following Coccinelle semantic patch:
```smpl
@@
EFI_FFS_FILE_HEADER *E;
typedef UINT32;
@@
(
- *(UINT32 *)(E->Size) & 0x00FFFFFF
+ FFS_FILE_SIZE (E)
|
- *(UINT32 *)E->Size & 0x00FFFFFF
+ FFS_FILE_SIZE (E)
)
```
Signed-off-by: Mingjie Shen <[email protected]>
Compare: https://github.com/tianocore/edk2/compare/d68e8b775ffd...76132a56892a
To unsubscribe from these emails, change your notification settings at
https://github.com/tianocore/edk2/settings/notifications
_______________________________________________
edk2-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-commits