grub-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] Initialize local relocator subchunk struct to all zeros


From: Ross Philipson
Subject: [PATCH] Initialize local relocator subchunk struct to all zeros
Date: Thu, 14 Jul 2022 09:41:28 -0400

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>
---
 grub-core/lib/relocator.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/grub-core/lib/relocator.c b/grub-core/lib/relocator.c
index 68ef128..bfcc70d 100644
--- a/grub-core/lib/relocator.c
+++ b/grub-core/lib/relocator.c
@@ -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];
-- 
1.8.3.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]