[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 2/6] loader/i386/bsd: Initialize ptr variable in grub_bsd_add_met
From: |
Daniel Kiper |
Subject: |
[PATCH 2/6] loader/i386/bsd: Initialize ptr variable in grub_bsd_add_meta() |
Date: |
Fri, 11 Mar 2022 00:35:56 +0100 |
Latest GCC may complain in that way:
In file included from ../include/grub/disk.h:31,
from ../include/grub/file.h:26,
from ../include/grub/loader.h:23,
from loader/i386/bsd.c:19:
loader/i386/bsd.c: In function ‘grub_cmd_openbsd’:
../include/grub/misc.h:71:10: error: ‘ptr’ may be used uninitialized in this
function [-Werror=maybe-uninitialized]
71 | return grub_memmove (dest, src, n);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~
loader/i386/bsd.c:266:9: note: ‘ptr’ was declared here
266 | void *ptr;
| ^~~
So, let's fix it by assigning NULL to ptr in grub_bsd_add_meta().
Signed-off-by: Daniel Kiper <daniel.kiper@oracle.com>
---
grub-core/loader/i386/bsd.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/grub-core/loader/i386/bsd.c b/grub-core/loader/i386/bsd.c
index 5f3290ce1..346c4f14a 100644
--- a/grub-core/loader/i386/bsd.c
+++ b/grub-core/loader/i386/bsd.c
@@ -263,7 +263,7 @@ grub_err_t
grub_bsd_add_meta (grub_uint32_t type, const void *data, grub_uint32_t len)
{
grub_err_t err;
- void *ptr;
+ void *ptr = NULL;
err = grub_bsd_add_meta_ptr (type, &ptr, len);
if (err)
--
2.11.0
- [PATCH 0/6] Various fixes and cleanups, Daniel Kiper, 2022/03/10
- [PATCH 1/6] osdep/windows/platform: Disable gcc9 -Waddress-of-packed-member, Daniel Kiper, 2022/03/10
- [PATCH 6/6] INSTALL: Add more cross-compiling Debian packages, Daniel Kiper, 2022/03/10
- [PATCH 5/6] configure: Drop ${grub_coredir} unneeded references, Daniel Kiper, 2022/03/10
- Re: [PATCH 0/6] Various fixes and cleanups, Robbie Harwood, 2022/03/11