]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
efi_loader: Prevent free of uninitialised pointer
authorAndrew Goodbody <andrew.goodbody@linaro.org>
Wed, 2 Jul 2025 10:01:38 +0000 (11:01 +0100)
committerIlias Apalodimas <ilias.apalodimas@linaro.org>
Thu, 3 Jul 2025 08:32:49 +0000 (11:32 +0300)
Taking a goto to out_of_resources before receive_lengths is assigned
will result in an attempt to free an unitialised pointer. Instead
initialise receive_lengths to NULL on declaration to prevent this from
occurring.

This issue was found by Smatch.

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

index 86f0af9538c87d6a3bb230c9d2d905ba6f0eb635..b8a6e08ba8e200a711f83d5b6ad1d0821d7a404d 100644 (file)
@@ -1131,7 +1131,7 @@ efi_status_t efi_net_register(struct udevice *dev)
        struct efi_net_obj *netobj;
        void *transmit_buffer = NULL;
        uchar **receive_buffer = NULL;
-       size_t *receive_lengths;
+       size_t *receive_lengths = NULL;
        int i, j;
 
        if (!dev) {