On 11/15/23 21:43, Qu Wenruo wrote:

I'm not sure why this happend for the EFI environment.

Doesn't the EFI runtime should also try to read the whole file? Or that
EFI environment has specified the length to read instead?


Hi Qu,

The Linux EFISTUB file loading routine (handle_cmdline_files) reads files in chunks, and not (necessarily) the whole file in one go. On x86 platforms, the chunk size is 1MB, and the comments explain that this is to work around firmware implementations that have problems with large reads. On non-x86 platforms, the chunk size is ULONG_MAX -- which in practice means it reads the whole file in one exact-filesize chunk.

So, to answer your questions: "either/both depending on platform."

(The bug in the U-Boot implementation doubtlessly affects more than just EFI; I only happened to discover it while trying to use EFI.)


Signed-off-by: Sam Edwards <[email protected]>

Anyway, the fix looks good to me.

Reviewed-by: Qu Wenruo <[email protected]>

Thank you greatly for the review!


Thanks,
Qu

Likewise,
Sam

Reply via email to