* Lukas Wunner <[email protected]> wrote:

> --- a/drivers/firmware/efi/libstub/efi-stub-helper.c
> +++ b/drivers/firmware/efi/libstub/efi-stub-helper.c
> @@ -413,6 +413,32 @@ static efi_status_t efi_file_close(void *handle)
>       return efi_call_proto(efi_file_handle, close, handle);
>  }
>  
> +static efi_status_t efi_open_volume(efi_system_table_t *sys_table_arg,
> +                                 efi_loaded_image_t *image,
> +                                 efi_file_handle_t **__fh)
> +{
> +     efi_file_io_interface_t *io;
> +     efi_file_handle_t *fh;
> +     efi_guid_t fs_proto = EFI_FILE_SYSTEM_GUID;
> +     efi_status_t status;
> +     void *handle =
> +             (void *)efi_table_attr(efi_loaded_image, device_handle, image);
> +
> +     status = efi_call_early(handle_protocol, handle,
> +                             &fs_proto, (void **)&io);
> +     if (status != EFI_SUCCESS) {
> +             efi_printk(sys_table_arg, "Failed to handle fs_proto\n");
> +             return status;
> +     }
> +
> +     status = efi_call_proto(efi_file_io_interface, open_volume, io, &fh);
> +     if (status != EFI_SUCCESS)
> +             efi_printk(sys_table_arg, "Failed to open volume\n");
> +
> +     *__fh = fh;
> +     return status;

BTW., in the second failure branch is 'fh' guaranteed to be set by the EFI 
call? 
If not then we set *__fh to a potentially undefined value, from the kernels 
stack?

(I realize that your refactoring just inherited this existing pattern, but it 
caught my attention.)

Thanks,

        Ingo
--
To unsubscribe from this list: send the line "unsubscribe linux-efi" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to