From: "Gerd Hoffmann" <kraxel@redhat.com>
To: devel@edk2.groups.io
Cc: Jordan Justen <jordan.l.justen@intel.com>,
Gerd Hoffmann <kraxel@redhat.com>,
Oliver Steffen <osteffen@redhat.com>,
Ard Biesheuvel <ardb+tianocore@kernel.org>,
Pawel Polawski <ppolawsk@redhat.com>,
Jiewen Yao <jiewen.yao@intel.com>
Subject: [PATCH 1/2] OvmfPkg/QemuBootOrderLib: allow slash in rom filenames
Date: Wed, 21 Sep 2022 07:30:44 +0200 [thread overview]
Message-ID: <20220921053045.92473-2-kraxel@redhat.com> (raw)
In-Reply-To: <20220921053045.92473-1-kraxel@redhat.com>
See comment for details. Needed to avoid the parser abort,
so we can continue parsing the bootorder fw_cfg file.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
.../QemuBootOrderLib/QemuBootOrderLib.c | 19 ++++++++++++++++++-
1 file changed, 18 insertions(+), 1 deletion(-)
diff --git a/OvmfPkg/Library/QemuBootOrderLib/QemuBootOrderLib.c b/OvmfPkg/Library/QemuBootOrderLib/QemuBootOrderLib.c
index 398de7fab4ba..374c6d8f5e91 100644
--- a/OvmfPkg/Library/QemuBootOrderLib/QemuBootOrderLib.c
+++ b/OvmfPkg/Library/QemuBootOrderLib/QemuBootOrderLib.c
@@ -432,6 +432,8 @@ ParseOfwNode (
OUT BOOLEAN *IsFinal
)
{
+ BOOLEAN AcceptSlash = FALSE;
+
//
// A leading slash is expected. End of string is tolerated.
//
@@ -464,6 +466,21 @@ ParseOfwNode (
return RETURN_INVALID_PARAMETER;
}
+ if (SubstringEq (OfwNode->DriverName, "rom")) {
+ //
+ // bug compatibility hack
+ //
+ // qemu passes fw_cfg filenames as rom unit address.
+ // The filenames have slashes:
+ // /rom@genroms/linuxboot_dma.bin
+ //
+ // Alow slashes in the unit address to avoid the parser trip up,
+ // so we can successfully parse the following lines (the rom
+ // entries themself are ignored).
+ //
+ AcceptSlash = TRUE;
+ }
+
//
// unit-address
//
@@ -475,7 +492,7 @@ ParseOfwNode (
OfwNode->UnitAddress.Ptr = *Ptr;
OfwNode->UnitAddress.Len = 0;
- while (IsPrintNotDelim (**Ptr)) {
+ while (IsPrintNotDelim (**Ptr) || (AcceptSlash && **Ptr == '/')) {
++*Ptr;
++OfwNode->UnitAddress.Len;
}
--
2.37.3
next prev parent reply other threads:[~2022-09-21 5:30 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-21 5:30 [PATCH 0/2] OvmfPkg/QemuBootOrderLib: StoreQemuBootOrder bugfix Gerd Hoffmann
2022-09-21 5:30 ` Gerd Hoffmann [this message]
2022-09-21 5:30 ` [PATCH 2/2] OvmfPkg/QemuBootOrderLib: skip over unsupported entries in StoreQemuBootOrder Gerd Hoffmann
2022-09-28 10:49 ` [PATCH 0/2] OvmfPkg/QemuBootOrderLib: StoreQemuBootOrder bugfix Ard Biesheuvel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220921053045.92473-2-kraxel@redhat.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox