From: Heinrich Schuchardt <xypron.glpk@gmx.de>
To: Masahisa Kojima <masahisa.kojima@linaro.org>
Cc: Ilias Apalodimas <ilias.apalodimas@linaro.org>, u-boot@lists.denx.de
Subject: Re: [PATCH 1/2] cmd: efidebug: add uri device path
Date: Thu, 24 Aug 2023 07:38:06 +0200 [thread overview]
Message-ID: <ff697396-ce30-e6c3-b7fa-5aac053dec4c@gmx.de> (raw)
In-Reply-To: <20230823083721.1318097-2-masahisa.kojima@linaro.org>
On 8/23/23 10:37, Masahisa Kojima wrote:
> This adds the URI device path option for 'boot add' subcommand.
> User can add the URI load option for downloading ISO image file
> or EFI application through network(e.g. HTTP).
>
> Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org>
> ---
> cmd/efidebug.c | 39 +++++++++++++++++++++++++++++++++++++++
> 1 file changed, 39 insertions(+)
>
> diff --git a/cmd/efidebug.c b/cmd/efidebug.c
> index 0be3af3e76..62f867df2a 100644
> --- a/cmd/efidebug.c
> +++ b/cmd/efidebug.c
> @@ -829,6 +829,44 @@ static int do_efi_boot_add(struct cmd_tbl *cmdtp, int flag,
> argc -= 1;
> argv += 1;
> break;
> + case 'u':
> + {
> + char *pos;
> + int uridp_len;
> + struct efi_device_path_uri *uridp;
> +
> + if (argc < 3 || lo.label) {
> + r = CMD_RET_USAGE;
> + goto out;
> + }
> + id = (int)hextoul(argv[1], &endp);
> + if (*endp != '\0' || id > 0xffff)
> + return CMD_RET_USAGE;
> +
> + efi_create_indexed_name(var_name16, sizeof(var_name16),
> + "Boot", id);
> +
> + label = efi_convert_string(argv[2]);
> + if (!label)
> + return CMD_RET_FAILURE;
> + lo.label = label;
> +
> + uridp_len = sizeof(struct efi_device_path) + strlen(argv[3]) + 1; > + fp_free = efi_alloc(uridp_len + sizeof(END));
> + uridp = (struct efi_device_path_uri *)fp_free;
> + uridp->dp.type = DEVICE_PATH_TYPE_MESSAGING_DEVICE;
> + uridp->dp.sub_type = DEVICE_PATH_SUB_TYPE_MSG_URI;
> + uridp->dp.length = uridp_len;
> + strcpy(uridp->uri, argv[3]);
This assumes that argv[3] is a valid URI.
Would it be preferable to validate that the string is percent encoded,
conforms to RFC 3986, and contains a supported scheme, an authority, and
a path?
As a user I would like related errors to be caught at entry and not at
runtime.
Best regards
Heinrich
> + pos = (char *)uridp + uridp_len;
> + memcpy(pos, &END, sizeof(END));
> + fp_size += uridp_len + sizeof(END);
> + file_path = (struct efi_device_path *)uridp;
> + argc -= 3;
> + argv += 3;
> + break;
> + }
> +
> default:
> r = CMD_RET_USAGE;
> goto out;
> @@ -1492,6 +1530,7 @@ static char efidebug_help_text[] =
> " -b|-B <bootid> <label> <interface> <devnum>[:<part>] <file path>\n"
> " -i|-I <interface> <devnum>[:<part>] <initrd file path>\n"
> " (-b, -i for short form device path)\n"
> + " -u <bootid> <label> <uri>\n"
> " -s '<optional data>'\n"
> "efidebug boot rm <bootid#1> [<bootid#2> [<bootid#3> [...]]]\n"
> " - delete UEFI BootXXXX variables\n"
next prev parent reply other threads:[~2023-08-24 5:37 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-23 8:37 [PATCH 0/2] Add EFI HTTP boot support Masahisa Kojima
2023-08-23 8:37 ` [PATCH 1/2] cmd: efidebug: add uri device path Masahisa Kojima
2023-08-24 0:11 ` AKASHI Takahiro
2023-08-25 5:57 ` Masahisa Kojima
2023-08-26 2:21 ` Heinrich Schuchardt
2023-08-28 6:02 ` Masahisa Kojima
2023-08-24 5:38 ` Heinrich Schuchardt [this message]
2023-08-25 5:58 ` Masahisa Kojima
2023-08-23 8:37 ` [PATCH 2/2] efi_loader: support boot from URI " Masahisa Kojima
2023-08-23 23:57 ` Simon Glass
2023-08-25 6:31 ` Masahisa Kojima
2023-08-24 2:24 ` AKASHI Takahiro
2023-08-24 2:32 ` AKASHI Takahiro
2023-08-25 6:40 ` Masahisa Kojima
2023-08-24 6:58 ` Heinrich Schuchardt
2023-08-25 7:56 ` Masahisa Kojima
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=ff697396-ce30-e6c3-b7fa-5aac053dec4c@gmx.de \
--to=xypron.glpk@gmx.de \
--cc=ilias.apalodimas@linaro.org \
--cc=masahisa.kojima@linaro.org \
--cc=u-boot@lists.denx.de \
/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