]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
lib/relocator: Initialize local relocator subchunk struct to all zeros
authorRoss Philipson <ross.philipson@oracle.com>
Thu, 14 Jul 2022 13:41:28 +0000 (09:41 -0400)
committerDaniel Kiper <daniel.kiper@oracle.com>
Wed, 27 Jul 2022 17:20:53 +0000 (19:20 +0200)
The way the code is written the tofree variable would never be passed to
the free_subchunk() function uninitialized. Coverity cannot determine
this and flags the situation as "Using uninitialized value...". The fix
is just to initialize the local struct.

Fixes: CID 314016
Signed-off-by: Ross Philipson <ross.philipson@oracle.com>
Reviewed-by: Darren Kenny <darren.kenny@oracle.com>
Tested-by: Alec Brown <alec.r.brown@oracle.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
grub-core/lib/relocator.c

index 68ef1289aa86b1d217d3a5b5b65f64f103d2033a..bfcc70dac3cce58de71d368e090370b5189b22f1 100644 (file)
@@ -989,7 +989,7 @@ malloc_in_range (struct grub_relocator *rel,
        if (j != 0 && events[j - 1].pos != events[j].pos)
          {
            grub_addr_t alloc_start, alloc_end;
-           struct grub_relocator_subchunk tofree;
+           struct grub_relocator_subchunk tofree = {0};
            struct grub_relocator_subchunk *curschu = &tofree;
            if (!oom)
              curschu = &res->subchunks[cural];