diff options
| author | Mingjie Shen <shen497@purdue.edu> | 2026-09-01 01:14:24 +0300 |
|---|---|---|
| committer | mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> | 2026-09-03 13:36:41 +0300 |
| commit | 76132a56892aa3178697d958991ac4d129cb7042 (patch) | |
| tree | d98300cdf6ddc7cc73a61bddc7568866045d6b73 /BaseTools/Source/Python/Workspace/MetaFileParser.py | |
| parent | 52f19aacd569aa0f1f264108ed518a96657f9088 (diff) | |
| download | edk2-76132a56892aa3178697d958991ac4d129cb7042.tar.xz | |
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 <shen497@purdue.edu>
Diffstat (limited to 'BaseTools/Source/Python/Workspace/MetaFileParser.py')
0 files changed, 0 insertions, 0 deletions
