grub-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 1/8] loader/linux: permit NULL argument for argv[] in grub_in


From: Heinrich Schuchardt
Subject: Re: [PATCH 1/8] loader/linux: permit NULL argument for argv[] in grub_initrd_load()
Date: Fri, 28 May 2021 21:17:57 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.10.0

On 5/28/21 3:04 PM, Nikita Ermakov wrote:
From: Ard Biesheuvel <ard.biesheuvel@arm.com>

grub_initrd_load() takes a char *argv[] argument which is only used
when an error occurs, to print the name of the file that caused the
error. In order to be able to split initrd loading from handling the
initrd command, let's permit argv to be NULL, and fall back to the
file names recorded in the file handles.

Signed-off-by: Ard Biesheuvel <ard.biesheuvel@arm.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 3fe390f17..8c0138177 100644
--- a/grub-core/loader/linux.c
+++ b/grub-core/loader/linux.c
@@ -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]);
+                       argv ? argv[i] : initrd_ctx->components[i].file->name);

Why do we need the argv[] argument at all? Can't we always print
initrd_ctx->components[i].file->name?

Best regards

Heinrich

          grub_initrd_close (initrd_ctx);
          return grub_errno;
        }





reply via email to

[Prev in Thread] Current Thread [Next in Thread]