Without the patch, the following gcc-12 compiler warnings are emitted for lkcd_*.c: lkcd_v1.c: In function 'dump_lkcd_environment_v1': lkcd_v1.c:252:20: warning: the comparison will always evaluate as 'true' for the address of 'dh_panic_string' will never be NULL [-Waddress] 252 | dh && dh->dh_panic_string && | ^~ In file included from lkcd_v1.c:21: lkcd_vmdump_v1.h:108:30: note: 'dh_panic_string' declared here 108 | char dh_panic_string[DUMP_PANIC_LEN]; | ^~~~~~~~~~~~~~~ ... Reported-by: Lianbo Jiang <lijiang@xxxxxxxxxx> Signed-off-by: Kazuhito Hagio <k-hagio-ab@xxxxxxx> --- v2 - fixed typo lkcd_v1.c | 3 +-- lkcd_v2_v3.c | 3 +-- lkcd_v5.c | 3 +-- lkcd_v7.c | 3 +-- lkcd_v8.c | 3 +-- 5 files changed, 5 insertions(+), 10 deletions(-) diff --git a/lkcd_v1.c b/lkcd_v1.c index 5f891ae..31bdc04 100644 --- a/lkcd_v1.c +++ b/lkcd_v1.c @@ -249,8 +249,7 @@ dump_header_only: lkcd_print(" dh_eip: %lx\n", dh->dh_eip); lkcd_print(" dh_num_pages: %d\n", dh->dh_num_pages); lkcd_print(" dh_panic_string: %s%s", dh->dh_panic_string, - dh && dh->dh_panic_string && - strstr(dh->dh_panic_string, "\n") ? "" : "\n"); + dh && strstr(dh->dh_panic_string, "\n") ? "" : "\n"); lkcd_print(" dh_time: %s\n", strip_linefeeds(ctime(&(dh->dh_time.tv_sec)))); diff --git a/lkcd_v2_v3.c b/lkcd_v2_v3.c index 8635a7b..edcb663 100644 --- a/lkcd_v2_v3.c +++ b/lkcd_v2_v3.c @@ -307,8 +307,7 @@ dump_header_only: lkcd_print(" dh_num_pages: "); lkcd_print(BITS32() ? "%ld\n" : "%d\n", dh->dh_num_pages); lkcd_print(" dh_panic_string: %s%s", dh->dh_panic_string, - dh && dh->dh_panic_string && - strstr(dh->dh_panic_string, "\n") ? "" : "\n"); + dh && strstr(dh->dh_panic_string, "\n") ? "" : "\n"); lkcd_print(" dh_time: %s\n", strip_linefeeds(ctime(&(dh->dh_time.tv_sec)))); diff --git a/lkcd_v5.c b/lkcd_v5.c index cb7634d..e3bfa6f 100644 --- a/lkcd_v5.c +++ b/lkcd_v5.c @@ -270,8 +270,7 @@ dump_header_only: lkcd_print(" dh_num_pages: "); lkcd_print(BITS32() ? "%ld\n" : "%d\n", dh->dh_num_pages); lkcd_print(" dh_panic_string: %s%s", dh->dh_panic_string, - dh && dh->dh_panic_string && - strstr(dh->dh_panic_string, "\n") ? "" : "\n"); + dh && strstr(dh->dh_panic_string, "\n") ? "" : "\n"); lkcd_print(" dh_time: %s\n", strip_linefeeds(ctime(&(dh->dh_time.tv_sec)))); diff --git a/lkcd_v7.c b/lkcd_v7.c index 608e148..97d9900 100644 --- a/lkcd_v7.c +++ b/lkcd_v7.c @@ -347,8 +347,7 @@ dump_header_only: lkcd_print(" dh_num_pages: "); lkcd_print(BITS32() ? "%ld\n" : "%d\n", dh->dh_num_pages); lkcd_print(" dh_panic_string: %s%s", dh->dh_panic_string, - dh && dh->dh_panic_string && - strstr(dh->dh_panic_string, "\n") ? "" : "\n"); + dh && strstr(dh->dh_panic_string, "\n") ? "" : "\n"); lkcd_print(" dh_time: %s\n", strip_linefeeds(ctime(&(dh->dh_time.tv_sec)))); diff --git a/lkcd_v8.c b/lkcd_v8.c index 3b355e0..4167fa5 100644 --- a/lkcd_v8.c +++ b/lkcd_v8.c @@ -543,8 +543,7 @@ dump_header_only: lkcd_print(" dh_num_pages: "); lkcd_print(BITS32() ? "%ld\n" : "%d\n", dh->dh_num_pages); lkcd_print(" dh_panic_string: %s%s", dh->dh_panic_string, - dh && dh->dh_panic_string && - strstr(dh->dh_panic_string, "\n") ? "" : "\n"); + dh && strstr(dh->dh_panic_string, "\n") ? "" : "\n"); tv.tv_sec = dh->dh_time.tv_sec; lkcd_print(" dh_time: %s\n", strip_linefeeds(ctime(&(tv.tv_sec)))); -- 2.37.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