efi_loader: Prevent dereference of uninitialised variable
authorAndrew Goodbody <andrew.goodbody@linaro.org>
Wed, 2 Jul 2025 10:01:37 +0000 (11:01 +0100)
committerIlias Apalodimas <ilias.apalodimas@linaro.org>
Thu, 3 Jul 2025 08:32:49 +0000 (11:32 +0300)
commit5753dc3f6572d42057a262f0e57e904e5c9cd9bc
tree032f03159cb7d2821e09f5a7fb14a33fb68da583
parent9d95a35715fcb8e81ee423e31273489a47ed1563
efi_loader: Prevent dereference of uninitialised variable

If phandler is returned as NULL from efi_search_protocol then
protocol_interface is never assigned to. Instead return
EFI_UNSUPPORTED as per the spec.

This issue found by Smatch.

Also eliminate the use of the variable protocol_interface as it is not
needed.

Signed-off-by: Andrew Goodbody <andrew.goodbody@linaro.org>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
lib/efi_loader/efi_http.c