From: Glenn Washburn <development@efficientek.com>
To: grub-devel@gnu.org, Daniel Kiper <dkiper@net-space.pl>
Cc: Glenn Washburn <development@efficientek.com>
Subject: [PATCH] loader/linux: Only emit newc directory once
Date: Wed, 28 Jun 2023 02:25:16 -0500 [thread overview]
Message-ID: <20230628072516.481118-1-development@efficientek.com> (raw)
When creating at runtime a newc initrd via arguments to initrd with "newc:"
prefixes, only emit a directory path record once. The original code
intended to do that by bailing out of emiting the record when the record
to be created matches an existing record. However, this does not happen
because grub_memcmp() is improperly checked.
Generating duplicate newc directory records does not cause any problems
because the linux unpacker will skip it once it sees the directory already
exists. This fix saves a little processing and makes the generated newc
cpio archive a little smaller.
Fixes: 92750e4c60 (Add ability to generate newc additions on runtime.)
Signed-off-by: Glenn Washburn <development@efficientek.com>
---
grub-core/loader/linux.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/grub-core/loader/linux.c b/grub-core/loader/linux.c
index 3948302d2c43..cb2c3f6e4f06 100644
--- a/grub-core/loader/linux.c
+++ b/grub-core/loader/linux.c
@@ -114,7 +114,7 @@ insert_dir (const char *name, struct dir **root,
break;
for (cur = *root; cur; cur = cur->next)
- if (grub_memcmp (cur->name, cb, ce - cb)
+ if (grub_memcmp (cur->name, cb, ce - cb) == 0
&& cur->name[ce - cb] == 0)
break;
if (!cur)
--
2.34.1
next reply other threads:[~2023-06-28 7:26 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-28 7:25 Glenn Washburn [this message]
2023-06-28 12:44 ` [PATCH] loader/linux: Only emit newc directory once Daniel Kiper
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-all 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=20230628072516.481118-1-development@efficientek.com \
--to=development@efficientek.com \
--cc=dkiper@net-space.pl \
--cc=grub-devel@gnu.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.