summaryrefslogtreecommitdiff
path: root/lib/efi_loader
diff options
context:
space:
mode:
authorHeinrich Schuchardt <heinrich.schuchardt@canonical.com>2023-05-27 09:18:28 +0300
committerHeinrich Schuchardt <heinrich.schuchardt@canonical.com>2023-06-02 11:59:15 +0300
commit1becdfcdc1eefecc061e34d7cc4eb92b403c5c4e (patch)
tree3b1858d906093ea424a46d64e239a25416f43769 /lib/efi_loader
parent5a2d5cbd3198c01c287fc0b284f50f89c6dec37a (diff)
downloadu-boot-1becdfcdc1eefecc061e34d7cc4eb92b403c5c4e.tar.xz
efi_loader: check return value of part_get_info()
part_get_info() may return an error code. Check it. Update function description of dp_part_node(). Addresses-Coverity-ID: 184067 ("Unchecked return value") Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Diffstat (limited to 'lib/efi_loader')
-rw-r--r--lib/efi_loader/efi_device_path.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/efi_loader/efi_device_path.c b/lib/efi_loader/efi_device_path.c
index 71923b1127..04ebb449ca 100644
--- a/lib/efi_loader/efi_device_path.c
+++ b/lib/efi_loader/efi_device_path.c
@@ -843,12 +843,17 @@ static unsigned dp_part_size(struct blk_desc *desc, int part)
* @buf buffer to which the device path is written
* @desc block device descriptor
* @part partition number, 0 identifies a block device
+ *
+ * Return: pointer to position after the node
*/
static void *dp_part_node(void *buf, struct blk_desc *desc, int part)
{
struct disk_partition info;
+ int ret;
- part_get_info(desc, part, &info);
+ ret = part_get_info(desc, part, &info);
+ if (ret < 0)
+ return buf;
if (desc->part_type == PART_TYPE_ISO) {
struct efi_device_path_cdrom_path *cddp = buf;