Received: from list by lists.gnu.org with archive (Exim 4.90_1) id 1lmcBW-0007s2-Pi for mharc-grub-devel@gnu.org; Fri, 28 May 2021 09:05:54 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49516) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lmcBS-0007qG-Jr for grub-devel@gnu.org; Fri, 28 May 2021 09:05:50 -0400 Received: from mail-lf1-f52.google.com ([209.85.167.52]:42978) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lmcBL-0002E5-VG for grub-devel@gnu.org; Fri, 28 May 2021 09:05:50 -0400 Received: by mail-lf1-f52.google.com with SMTP id a2so5191821lfc.9 for ; Fri, 28 May 2021 06:05:42 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=EX/K3vcV21Hcr7AM8HDb7WioL8YNulPjBji5SKea93s=; b=LQTs2n/MOiQzLD5P2MFjTncuBqqRQArxUbIgWmV58gA2f0AUtnQL2tkaY55BClJgRI 8Urbv7nBcqYSmmUF8I/F8RGaoLHyEBYsHTUapaCQWj/ZswTAUmbVNo797aXAsMjN8fY9 rkuGd9CpME8QRBzWYP1B3yLYFPvVhHw6zZsBj4RE2RrHd/VHtHGc6aq2V80HJsIqj8wQ 6/7FtkIWPA8Qy+TGK41vm80Mp8F7zu7yzINicQrwkbTVbYQguueenRfbtSH/WRuWZUWE wa/O6AwOEIqVhl9B17hZDLRcY499CtUeBuzq2WNTSuuRdwnVTExsnJYzCIWMRz0oEp/9 q/tA== X-Gm-Message-State: AOAM530JiJ0bhPi4dWSd2I4t/DaBww3VWukLu0v6iFW305oPgc+bhHct ymFjIwf25T9j4w+omPCDUrzqBrucOT5tra955g+OFg== X-Google-Smtp-Source: ABdhPJzd8p8t4LCGjtSl10SEa0R9BUnI7IhEPetZQaVK8h6Dm31ZUqNL6Jezi23xaVO34ym/vmWWCA== X-Received: by 2002:a05:6512:21a:: with SMTP id a26mr5940096lfo.468.1622207140579; Fri, 28 May 2021 06:05:40 -0700 (PDT) Received: from localhost.localdomain (109-252-124-217.nat.spd-mgts.ru. [109.252.124.217]) by smtp.gmail.com with ESMTPSA id m25sm468129lfr.288.2021.05.28.06.05.40 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 28 May 2021 06:05:40 -0700 (PDT) From: Nikita Ermakov To: GRUB development mailing list Cc: Ard Biesheuvel , Atish Patra , Daniel Kiper , Heinrich Schuchardt , Leif Lindholm , Nikita Ermakov Subject: [PATCH 1/8] loader/linux: permit NULL argument for argv[] in grub_initrd_load() Date: Fri, 28 May 2021 16:04:50 +0300 Message-Id: <20210528130457.13501-2-arei@altlinux.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210528130457.13501-1-arei@altlinux.org> References: <20210528130457.13501-1-arei@altlinux.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=209.85.167.52; envelope-from=coffe92@gmail.com; helo=mail-lf1-f52.google.com X-Spam_score_int: -10 X-Spam_score: -1.1 X-Spam_bar: - X-Spam_report: (-1.1 / 5.0 requ) BAYES_00=-1.9, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FORGED_FROMDOMAIN=0.25, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 May 2021 13:05:50 -0000 From: Ard Biesheuvel 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 --- 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); grub_initrd_close (initrd_ctx); return grub_errno; } -- 2.31.1