From: Ard Biesheuvel <ardb@kernel.org>
To: grub-devel@nongnu.org
Cc: linux-efi@vger.kernel.org, Ard Biesheuvel <ardb@kernel.org>,
grub-devel@gnu.org, Daniel Kiper <daniel.kiper@oracle.com>,
Nikita Ermakov <arei@altlinux.org>,
Atish Patra <atishp@atishpatra.org>,
Huacai Chen <chenhuacai@loongson.cn>,
Heinrich Schuchardt <heinrich.schuchardt@canonical.com>,
dann frazier <dann.frazier@canonical.com>,
Julian Andres Klode <julian.klode@canonical.com>
Subject: [PATCH resend 1/9] loader: drop argv[] argument in grub_initrd_load()
Date: Thu, 18 Aug 2022 10:55:31 +0200 [thread overview]
Message-ID: <20220818085540.2075028-2-ardb@kernel.org> (raw)
In-Reply-To: <20220818085540.2075028-1-ardb@kernel.org>
From: Nikita Ermakov <arei@altlinux.org>
In the case of an error grub_initrd_load() uses argv[] to print the
filename that caused the error. It is also possible to obtain the
filename from the file handles and there is no need to duplicate that
information in argv[], so let's drop it.
Signed-off-by: Nikita Ermakov <arei@altlinux.org>
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
---
grub-core/loader/arm/linux.c | 2 +-
grub-core/loader/arm64/linux.c | 2 +-
grub-core/loader/i386/linux.c | 2 +-
grub-core/loader/i386/pc/linux.c | 2 +-
grub-core/loader/i386/xen.c | 3 +--
grub-core/loader/ia64/efi/linux.c | 2 +-
grub-core/loader/linux.c | 4 ++--
grub-core/loader/mips/linux.c | 2 +-
grub-core/loader/powerpc/ieee1275/linux.c | 2 +-
grub-core/loader/sparc64/ieee1275/linux.c | 2 +-
include/grub/linux.h | 2 +-
11 files changed, 12 insertions(+), 13 deletions(-)
diff --git a/grub-core/loader/arm/linux.c b/grub-core/loader/arm/linux.c
index 30b366601c39..f00b538ebad0 100644
--- a/grub-core/loader/arm/linux.c
+++ b/grub-core/loader/arm/linux.c
@@ -422,7 +422,7 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)),
grub_dprintf ("loader", "Loading initrd to 0x%08x\n",
(grub_addr_t) initrd_start);
- if (grub_initrd_load (&initrd_ctx, argv, (void *) initrd_start))
+ if (grub_initrd_load (&initrd_ctx, (void *) initrd_start))
goto fail;
initrd_end = initrd_start + size;
diff --git a/grub-core/loader/arm64/linux.c b/grub-core/loader/arm64/linux.c
index ef3e9f9444ca..aed7a200b848 100644
--- a/grub-core/loader/arm64/linux.c
+++ b/grub-core/loader/arm64/linux.c
@@ -266,7 +266,7 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)),
goto fail;
}
- if (grub_initrd_load (&initrd_ctx, argv, initrd_mem))
+ if (grub_initrd_load (&initrd_ctx, initrd_mem))
goto fail;
initrd_start = (grub_addr_t) initrd_mem;
diff --git a/grub-core/loader/i386/linux.c b/grub-core/loader/i386/linux.c
index c5984d4b27e9..edd6c2bb1d23 100644
--- a/grub-core/loader/i386/linux.c
+++ b/grub-core/loader/i386/linux.c
@@ -1107,7 +1107,7 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)),
initrd_mem_target = get_physical_target_address (ch);
}
- if (grub_initrd_load (&initrd_ctx, argv, initrd_mem))
+ if (grub_initrd_load (&initrd_ctx, initrd_mem))
goto fail;
grub_dprintf ("linux", "Initrd, addr=0x%x, size=0x%x\n",
diff --git a/grub-core/loader/i386/pc/linux.c b/grub-core/loader/i386/pc/linux.c
index 7b89d431051e..4adeee9ae001 100644
--- a/grub-core/loader/i386/pc/linux.c
+++ b/grub-core/loader/i386/pc/linux.c
@@ -462,7 +462,7 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)),
initrd_addr = get_physical_target_address (ch);
}
- if (grub_initrd_load (&initrd_ctx, argv, initrd_chunk))
+ if (grub_initrd_load (&initrd_ctx, initrd_chunk))
goto fail;
lh->ramdisk_image = initrd_addr;
diff --git a/grub-core/loader/i386/xen.c b/grub-core/loader/i386/xen.c
index cd24874ca324..3b856e842709 100644
--- a/grub-core/loader/i386/xen.c
+++ b/grub-core/loader/i386/xen.c
@@ -809,8 +809,7 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)),
if (err)
goto fail;
- if (grub_initrd_load (&initrd_ctx, argv,
- get_virtual_current_address (ch)))
+ if (grub_initrd_load (&initrd_ctx, get_virtual_current_address (ch)))
goto fail;
}
diff --git a/grub-core/loader/ia64/efi/linux.c b/grub-core/loader/ia64/efi/linux.c
index 41266109e03c..fb9b961f71a2 100644
--- a/grub-core/loader/ia64/efi/linux.c
+++ b/grub-core/loader/ia64/efi/linux.c
@@ -563,7 +563,7 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)),
grub_dprintf ("linux", "[addr=0x%lx, size=0x%lx]\n",
(grub_uint64_t) initrd_mem, initrd_size);
- if (grub_initrd_load (&initrd_ctx, argv, initrd_mem))
+ if (grub_initrd_load (&initrd_ctx, initrd_mem))
goto fail;
fail:
grub_initrd_close (&initrd_ctx);
diff --git a/grub-core/loader/linux.c b/grub-core/loader/linux.c
index ade9b2fef470..830360172c3d 100644
--- a/grub-core/loader/linux.c
+++ b/grub-core/loader/linux.c
@@ -271,7 +271,7 @@ grub_initrd_close (struct grub_linux_initrd_context *initrd_ctx)
grub_err_t
grub_initrd_load (struct grub_linux_initrd_context *initrd_ctx,
- char *argv[], void *target)
+ void *target)
{
grub_uint8_t *ptr = target;
int i;
@@ -317,7 +317,7 @@ grub_initrd_load (struct grub_linux_initrd_context *initrd_ctx,
{
if (!grub_errno)
grub_error (GRUB_ERR_FILE_READ_ERROR, N_("premature end of file %s"),
- argv[i]);
+ initrd_ctx->components[i].file->name);
grub_initrd_close (initrd_ctx);
return grub_errno;
}
diff --git a/grub-core/loader/mips/linux.c b/grub-core/loader/mips/linux.c
index 2f912c61ccda..7264ba2b663b 100644
--- a/grub-core/loader/mips/linux.c
+++ b/grub-core/loader/mips/linux.c
@@ -452,7 +452,7 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)),
initrd_dest = get_physical_target_address (ch) | 0x80000000;
}
- if (grub_initrd_load (&initrd_ctx, argv, initrd_src))
+ if (grub_initrd_load (&initrd_ctx, initrd_src))
goto fail;
#ifdef GRUB_MACHINE_MIPS_QEMU_MIPS
diff --git a/grub-core/loader/powerpc/ieee1275/linux.c b/grub-core/loader/powerpc/ieee1275/linux.c
index 6fdd86313083..e6d071508d8d 100644
--- a/grub-core/loader/powerpc/ieee1275/linux.c
+++ b/grub-core/loader/powerpc/ieee1275/linux.c
@@ -349,7 +349,7 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)),
grub_dprintf ("loader", "Loading initrd at 0x%x, size 0x%x\n", addr, size);
- if (grub_initrd_load (&initrd_ctx, argv, (void *) addr))
+ if (grub_initrd_load (&initrd_ctx, (void *) addr))
goto fail;
initrd_addr = addr;
diff --git a/grub-core/loader/sparc64/ieee1275/linux.c b/grub-core/loader/sparc64/ieee1275/linux.c
index bb47ee0cc640..ac2206f3c051 100644
--- a/grub-core/loader/sparc64/ieee1275/linux.c
+++ b/grub-core/loader/sparc64/ieee1275/linux.c
@@ -413,7 +413,7 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)),
grub_dprintf ("loader", "Loading initrd at vaddr 0x%lx, paddr 0x%lx, size 0x%lx\n",
addr, paddr, size);
- if (grub_initrd_load (&initrd_ctx, argv, (void *) addr))
+ if (grub_initrd_load (&initrd_ctx, (void *) addr))
goto fail;
initrd_addr = addr;
diff --git a/include/grub/linux.h b/include/grub/linux.h
index 594a3f3079b0..a96ac20483d3 100644
--- a/include/grub/linux.h
+++ b/include/grub/linux.h
@@ -21,4 +21,4 @@ grub_initrd_close (struct grub_linux_initrd_context *initrd_ctx);
grub_err_t
grub_initrd_load (struct grub_linux_initrd_context *initrd_ctx,
- char *argv[], void *target);
+ void *target);
--
2.35.1
next prev parent reply other threads:[~2022-08-18 8:55 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-18 8:55 [PATCH resend 0/9] linux: implement LoadFile2 initrd loading Ard Biesheuvel
2022-08-18 8:55 ` Ard Biesheuvel [this message]
2022-08-18 8:55 ` [PATCH resend 2/9] efi: move MS-DOS stub out of generic PE header definition Ard Biesheuvel
2022-08-18 8:55 ` [PATCH resend 3/9] arm64/linux: Remove magic number header field check Ard Biesheuvel
2022-08-18 8:55 ` [PATCH resend 4/9] linux/arm: unify ARM/arm64 vs Xen PE/COFF header handling Ard Biesheuvel
2022-08-18 8:55 ` [PATCH resend 5/9] linux/arm: account for COFF headers appearing at unexpected offsets Ard Biesheuvel
2022-08-18 8:55 ` [PATCH resend 6/9] efi: add definition of LoadFile2 protocol Ard Biesheuvel
2022-08-18 8:55 ` [PATCH resend 7/9] efi/efinet: Don't close connections at fini_hw() time Ard Biesheuvel
2022-08-18 8:55 ` [PATCH resend 8/9] efi: implement LoadFile2 initrd loading protocol for Linux Ard Biesheuvel
2022-09-08 7:29 ` Ilias Apalodimas
2022-08-18 8:55 ` [PATCH resend 9/9] linux: ignore FDT unless we need to modify it Ard Biesheuvel
2022-08-18 8:58 ` [PATCH resend 0/9] linux: implement LoadFile2 initrd loading 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-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=20220818085540.2075028-2-ardb@kernel.org \
--to=ardb@kernel.org \
--cc=arei@altlinux.org \
--cc=atishp@atishpatra.org \
--cc=chenhuacai@loongson.cn \
--cc=daniel.kiper@oracle.com \
--cc=dann.frazier@canonical.com \
--cc=grub-devel@gnu.org \
--cc=grub-devel@nongnu.org \
--cc=heinrich.schuchardt@canonical.com \
--cc=julian.klode@canonical.com \
--cc=linux-efi@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox