efi: fix devpath_is_partition()

If the path consists only of an end node, it does not refer to a partition.
Avoid returning a random value from the stack in this case.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
This commit is contained in:
Heinrich Schuchardt 2022-04-25 23:21:20 +02:00
parent 7ea79e511d
commit dd1086ac6b

View File

@ -190,7 +190,7 @@ static void free_memory(struct efi_priv *priv)
static bool devpath_is_partition(const struct efi_device_path *path)
{
const struct efi_device_path *p;
bool was_part;
bool was_part = false;
for (p = path; p->type != DEVICE_PATH_TYPE_END;
p = (void *)p + p->length) {