From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.90_1) id 1lmhzq-00057h-Vv for mharc-grub-devel@gnu.org; Fri, 28 May 2021 15:18:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55712) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lmhzn-00057P-VH for grub-devel@gnu.org; Fri, 28 May 2021 15:18:12 -0400 Received: from mout.gmx.net ([212.227.17.20]:43521) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lmhzj-0005IY-7o for grub-devel@gnu.org; Fri, 28 May 2021 15:18:10 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1622229478; bh=AEDkSJnCfNKYjmFmlJ1wSMO0pUZGmNxo/QqalClqkMY=; h=X-UI-Sender-Class:Subject:To:Cc:References:From:Date:In-Reply-To; b=lBaS/zSDNARAXiEyeJMy6ktuLlz+cWTjZ8FxPe83sWH414GoQJm8X8gHZKsHMzb/Z meFTlyJSF5xiaTGRVtzo+s3P0bwTzv7pvhZ6iKZfKSRJ10GGi2omd/NWZFYLavwGh4 NIPEfeg4GQ70L9U7TSxE5rTH9x79ZsrWDUd/fp9E= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from [192.168.123.35] ([62.143.247.63]) by mail.gmx.net (mrgmx104 [212.227.17.168]) with ESMTPSA (Nemesis) id 1MwQXN-1lW0Q72AmD-00sLQ0; Fri, 28 May 2021 21:17:58 +0200 Subject: Re: [PATCH 1/8] loader/linux: permit NULL argument for argv[] in grub_initrd_load() To: Nikita Ermakov , Ard Biesheuvel Cc: Atish Patra , Daniel Kiper , Leif Lindholm , GRUB development mailing list , Daniel Kiper References: <20210528130457.13501-1-arei@altlinux.org> <20210528130457.13501-2-arei@altlinux.org> From: Heinrich Schuchardt Message-ID: 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 MIME-Version: 1.0 In-Reply-To: <20210528130457.13501-2-arei@altlinux.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:4594VwxIdIRSS6lHQNg0uXCABmJo+WXdlJNJt02klrPmSFRffV0 33Cc6nH5DHXV9W8LZU+aQMFRnmiBew8dVMN/9qr75KD4P37H+EhM0N2NVvaCOWrtfp+XFkJ N7wBUP6YPlImtT3mITRSfZrzoExN7dBNc60IzwLYvqF6p1J5rph60ttzeY6GOW2HFIkO3H9 jtfBD1h6o95rdJ+S+hitA== X-UI-Out-Filterresults: notjunk:1;V03:K0:Y6m0oEmHcL4=:68qUf+hYKJNeqDGlThOYUD 9tx7LroJJ6QIwN01U5+9LXXr7BiNZ2DAQLIKwvSn1tzb3QJqZ2hu/U6Bx1fNaMBIRlN25bF5T u1YEEEgGhNe4bdA4oCbsxaeG81qsDHWzs/wUwu6N0zmYBeh/6RJoaFA7N5Gbg9y7bxZC6yzBl mmX93F9k5jb5FS5oy2QtsQGpXaQMsRKwf7HPNCpdEQslmuKPe5TBrUjvgPB6A0k59S30weGJ7 wV2F0fJY01sXftlKPipksLfopkpZ1vgYqXezsF7+OHX4qjex0AmZ0nqp3gpAnL1Q7XeQT3c4v YzIpSbIOGpujrp6u14kxTM7oH/0Hd9OfVzYZ9Cila0GTf2gAFSWa9Vt+mbOSGA4+ZceQg7AhF sddtxIJWpZ7QO3o3J6g6Wbj4wb6/D0CzpY9YVDGn47W5kfzHT4IrGH25WAsvXyNek4vvpSC7F lQ4+4nSpduD1PfKjRfe5t/+l19BRcRchrMR1OZQJyUyMLviBlFY8Awi4/HXbHjVg8Hnot/boH cXeYagHCfO/WVHfbSxmLIzBZ84FjTukCdtVrNsxHyOT8Eaf2hYe35r6eVTHYU07d2KA9Xgik9 EuavdOhvAf76unBkU4V4uqkqhI2qoT0J0SWBuohWbvEhBhoDgx47SEOv1pTtnUKlEsr5oP+bj lgByIaBNevZVCuJP+7tX4POrsDF70XauM6rG44e4N3kxBQosQOwZNJK2qmGJ7jUHbiv64H2Ea VLOGUXPBkz+MG93tDnbF+MyM0PL6iSJ4Gu3CcofLb6Y0w4HS+LrK3wMxpWgcyxfR97X2I7wuB pW49zJGXEnT0JgecFMcz5Rze9+SLToEMkqGmgq3qabw8bycLSNbUqXg0jtiU1qkfz22sUJ+eJ r+ibO7muU2U7GytqjrOPJWpt82w1fGjPekcJERVS78Aez3NA1ZgldV6JRzyNlJ0iu71YS3492 CFweYMAqsR31CL7BAgSNoj4b0EgAnaGxIeyJRn0vsrxo0SEAHUGeahYUFSiJdGcLXKeT2Dmfx DH+VoJNc1LYkBQfTQORrAxQYd+ozS4MNvGzDk3Y3ymqL6ruKnZBFwpltUgyMMPQVbUU+RHqRG pgUMi5JGDzrJ3sR8NbutNkIjqFmlrCFW5zV Received-SPF: pass client-ip=212.227.17.20; envelope-from=xypron.glpk@gmx.de; helo=mout.gmx.net X-Spam_score_int: -25 X-Spam_score: -2.6 X-Spam_bar: -- X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, FREEMAIL_FROM=0.001, NICE_REPLY_A=-0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham 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 19:18:12 -0000 On 5/28/21 3:04 PM, Nikita Ermakov wrote: > 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); 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; > } >