On Thu, Oct 26, 2023 at 11:02 AM HAGIO KAZUHITO(萩尾 一仁) <k-hagio-ab@xxxxxxx> wrote:
Fix the following compilation error in diskdump.c and warning in
xen_hyper.c with gcc-4.8.5 (e.g. RHEL7).
- diskdump.c: In function 'try_zram_decompress':
diskdump.c:3048:3: error: 'for' loop initial declarations are only allowed in C99 mode
for (int count = 0; count < PAGESIZE() / sizeof(ulong); count++) {
^
diskdump.c:3048:3: note: use option -std=c99 or -std=gnu99 to compile your code
make[4]: *** [diskdump.o] Error 1
make[3]: *** [gdb] Error 2
make[2]: *** [rebuild] Error 2
make[1]: *** [gdb_merge] Error 2
make: *** [all] Error 2
- xen_hyper.c: In function 'xen_hyper_x86_pcpu_init':
xen_hyper.c:387:36: warning: 'init_tss' may be used uninitialized in this function [-Wmaybe-uninitialized]
xen_hyper_store_pcpu_context_tss(pcc, init_tss, buf);
^
Good findings, Kazu.
For the patch: Ack.
Thanks.
Lianbo
Fixes: 0172e35083b5 ("Fix "rd" command to display data on zram on Linux 5.17 and later")
Fixes: 9ee564cd1a46 ("xen: get stack address via stack_base array if available")
Signed-off-by: Kazuhito Hagio <k-hagio-ab@xxxxxxx>
---
diskdump.c | 3 ++-
xen_hyper.c | 2 +-
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/diskdump.c b/diskdump.c
index 9ab2d9450e03..0fe46f4644d0 100644
--- a/diskdump.c
+++ b/diskdump.c
@@ -3044,8 +3044,9 @@ try_zram_decompress(ulonglong pte_val, unsigned char *buf, ulong len, ulonglong
readmem(zram_table_entry + OFFSET(zram_table_flag), KVADDR, &flags,
sizeof(void *), "zram_table_flag", FAULT_ON_ERROR);
if (!entry || (flags & ZRAM_FLAG_SAME_BIT)) {
+ int count;
ulong *same_buf = (ulong *)GETBUF(PAGESIZE());
- for (int count = 0; count < PAGESIZE() / sizeof(ulong); count++) {
+ for (count = 0; count < PAGESIZE() / sizeof(ulong); count++) {
same_buf[count] = entry;
}
memcpy(buf, same_buf + off, len);
diff --git a/xen_hyper.c b/xen_hyper.c
index dbbfdaa3c154..32e56faa9a0c 100644
--- a/xen_hyper.c
+++ b/xen_hyper.c
@@ -324,7 +324,7 @@ void
xen_hyper_x86_pcpu_init(void)
{
ulong cpu_info;
- ulong init_tss_base, init_tss, stack_base = 0;
+ ulong init_tss_base, init_tss = 0, stack_base = 0;
ulong sp;
struct xen_hyper_pcpu_context *pcc;
char *buf, *bp;
--
1.8.3.1
-- Crash-utility mailing list Crash-utility@xxxxxxxxxx https://listman.redhat.com/mailman/listinfo/crash-utility Contribution Guidelines: https://github.com/crash-utility/crash/wiki