diff options
author | AKASHI Takahiro <takahiro.akashi@linaro.org> | 2019-04-16 17:39:26 +0200 |
---|---|---|
committer | Heinrich Schuchardt <xypron.glpk@gmx.de> | 2019-04-23 00:37:27 +0200 |
commit | f86076d885b29b71064ef3a1f5b1ada1bd92866c (patch) | |
tree | 225e0791fb47a7bb2be4d429bae037f8f7833957 /lib | |
parent | 6c5f8dd540d7a8eff244d4c27a09451ca12c8d20 (diff) | |
download | u-boot-f86076d885b29b71064ef3a1f5b1ada1bd92866c.tar.gz |
efi_loader: efi_setup_loaded_image() handle missing file name
This is a preparatory patch.
efi_dp_split_file_path() is used to create device_path and file_path
from file_path for efi_setup_loaded_image().
In a special case, however, of HARDWARE_DEVICE/MEMORY, it doesn't
work expectedly since this path doesn't contain any FILE_PATH sub-type.
This patch makes a workaround.
Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Adjust the logic such that for all paths that do no end on a media file
path we return NULL as file_path.
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/efi_loader/efi_device_path.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/efi_loader/efi_device_path.c b/lib/efi_loader/efi_device_path.c index d8c052d6ec..6104c7d33b 100644 --- a/lib/efi_loader/efi_device_path.c +++ b/lib/efi_loader/efi_device_path.c @@ -917,14 +917,14 @@ struct efi_device_path *efi_dp_from_mem(uint32_t memory_type, * * @full_path: device path including device and file path * @device_path: path of the device - * @file_path: relative path of the file + * @file_path: relative path of the file or NULL if there is none * Return: status code */ efi_status_t efi_dp_split_file_path(struct efi_device_path *full_path, struct efi_device_path **device_path, struct efi_device_path **file_path) { - struct efi_device_path *p, *dp, *fp; + struct efi_device_path *p, *dp, *fp = NULL; *device_path = NULL; *file_path = NULL; @@ -935,7 +935,7 @@ efi_status_t efi_dp_split_file_path(struct efi_device_path *full_path, while (!EFI_DP_TYPE(p, MEDIA_DEVICE, FILE_PATH)) { p = efi_dp_next(p); if (!p) - return EFI_INVALID_PARAMETER; + goto out; } fp = efi_dp_dup(p); if (!fp) @@ -944,6 +944,7 @@ efi_status_t efi_dp_split_file_path(struct efi_device_path *full_path, p->sub_type = DEVICE_PATH_SUB_TYPE_END; p->length = sizeof(*p); +out: *device_path = dp; *file_path = fp; return EFI_SUCCESS; |