Names of firmware configuration files always take 56 bytes (including at
least one terminating NUL byte). Expose this constant to all consumers of
QemuFwCfgLib because further interfaces may depend on it.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <ler...@redhat.com>
---

Notes:
    v2:
    - patch is new in v2

 OvmfPkg/Include/Library/QemuFwCfgLib.h      | 6 ++++++
 OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c | 2 +-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/OvmfPkg/Include/Library/QemuFwCfgLib.h 
b/OvmfPkg/Include/Library/QemuFwCfgLib.h
index 8d3b835..baaa257 100644
--- a/OvmfPkg/Include/Library/QemuFwCfgLib.h
+++ b/OvmfPkg/Include/Library/QemuFwCfgLib.h
@@ -16,8 +16,14 @@
 
 #ifndef __FW_CFG_LIB__
 #define __FW_CFG_LIB__
 
+//
+// The size, in bytes, of names of firmware configuration files, including at
+// least one terminating NUL byte.
+//
+#define QEMU_FW_CFG_FNAME_SIZE 56
+
 typedef enum {
   QemuFwCfgItemSignature            = 0x0000,
   QemuFwCfgItemInterfaceVersion     = 0x0001,
   QemuFwCfgItemSystemUuid           = 0x0002,
diff --git a/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c 
b/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c
index 92c85c1..24424f8 100644
--- a/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c
+++ b/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c
@@ -277,9 +277,9 @@ QemuFwCfgFindFile (
   for (Idx = 0; Idx < Count; ++Idx) {
     UINT32 FileSize;
     UINT16 FileSelect;
     UINT16 FileReserved;
-    CHAR8  FName[56];
+    CHAR8  FName[QEMU_FW_CFG_FNAME_SIZE];
 
     FileSize     = QemuFwCfgRead32 ();
     FileSelect   = QemuFwCfgRead16 ();
     FileReserved = QemuFwCfgRead16 ();
-- 
1.8.3.1



------------------------------------------------------------------------------
HPCC Systems Open Source Big Data Platform from LexisNexis Risk Solutions
Find What Matters Most in Your Big Data with HPCC Systems
Open Source. Fast. Scalable. Simple. Ideal for Dirty Data.
Leverages Graph Analysis for Fast Processing & Easy Data Exploration
http://p.sf.net/sfu/hpccsystems
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel

Reply via email to