lib/relocator: Initialize local relocator subchunk struct to all zeros

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>
This commit is contained in:
Ross Philipson authored and Daniel Kiper committed 2022-07-27 19:20:53 +02:00
1 parent 4c76565b6c
commit f7f453e0bf
1 file changed
+1 -1
+1 -1
View File
@@ -989,7 +989,7 @@ malloc_in_range (struct grub_relocator *rel,
if (j != 0 && events[j - 1].pos != events[j].pos) if (j != 0 && events[j - 1].pos != events[j].pos)
{ {
grub_addr_t alloc_start, alloc_end; grub_addr_t alloc_start, alloc_end;
struct grub_relocator_subchunk tofree; struct grub_relocator_subchunk tofree = {0};
struct grub_relocator_subchunk *curschu = &tofree; struct grub_relocator_subchunk *curschu = &tofree;
if (!oom) if (!oom)
curschu = &res->subchunks[cural]; curschu = &res->subchunks[cural];