Skip to content

Commit 51acac7

Browse files
committed
Fix gcc-12 compiler warnings on lkcd_*.c
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 <[email protected]> Signed-off-by: Kazuhito Hagio <[email protected]>
1 parent 5b9d3e9 commit 51acac7

File tree

5 files changed

+5
-10
lines changed

5 files changed

+5
-10
lines changed

lkcd_v1.c

+1-2
Original file line numberDiff line numberDiff line change
@@ -249,8 +249,7 @@ dump_lkcd_environment_v1(ulong arg)
249249
lkcd_print(" dh_eip: %lx\n", dh->dh_eip);
250250
lkcd_print(" dh_num_pages: %d\n", dh->dh_num_pages);
251251
lkcd_print(" dh_panic_string: %s%s", dh->dh_panic_string,
252-
dh && dh->dh_panic_string &&
253-
strstr(dh->dh_panic_string, "\n") ? "" : "\n");
252+
dh && strstr(dh->dh_panic_string, "\n") ? "" : "\n");
254253
lkcd_print(" dh_time: %s\n",
255254
strip_linefeeds(ctime(&(dh->dh_time.tv_sec))));
256255

lkcd_v2_v3.c

+1-2
Original file line numberDiff line numberDiff line change
@@ -307,8 +307,7 @@ dump_lkcd_environment_v2_v3(ulong arg)
307307
lkcd_print(" dh_num_pages: ");
308308
lkcd_print(BITS32() ? "%ld\n" : "%d\n", dh->dh_num_pages);
309309
lkcd_print(" dh_panic_string: %s%s", dh->dh_panic_string,
310-
dh && dh->dh_panic_string &&
311-
strstr(dh->dh_panic_string, "\n") ? "" : "\n");
310+
dh && strstr(dh->dh_panic_string, "\n") ? "" : "\n");
312311
lkcd_print(" dh_time: %s\n",
313312
strip_linefeeds(ctime(&(dh->dh_time.tv_sec))));
314313

lkcd_v5.c

+1-2
Original file line numberDiff line numberDiff line change
@@ -270,8 +270,7 @@ dump_lkcd_environment_v5(ulong arg)
270270
lkcd_print(" dh_num_pages: ");
271271
lkcd_print(BITS32() ? "%ld\n" : "%d\n", dh->dh_num_pages);
272272
lkcd_print(" dh_panic_string: %s%s", dh->dh_panic_string,
273-
dh && dh->dh_panic_string &&
274-
strstr(dh->dh_panic_string, "\n") ? "" : "\n");
273+
dh && strstr(dh->dh_panic_string, "\n") ? "" : "\n");
275274
lkcd_print(" dh_time: %s\n",
276275
strip_linefeeds(ctime(&(dh->dh_time.tv_sec))));
277276

lkcd_v7.c

+1-2
Original file line numberDiff line numberDiff line change
@@ -347,8 +347,7 @@ dump_lkcd_environment_v7(ulong arg)
347347
lkcd_print(" dh_num_pages: ");
348348
lkcd_print(BITS32() ? "%ld\n" : "%d\n", dh->dh_num_pages);
349349
lkcd_print(" dh_panic_string: %s%s", dh->dh_panic_string,
350-
dh && dh->dh_panic_string &&
351-
strstr(dh->dh_panic_string, "\n") ? "" : "\n");
350+
dh && strstr(dh->dh_panic_string, "\n") ? "" : "\n");
352351
lkcd_print(" dh_time: %s\n",
353352
strip_linefeeds(ctime(&(dh->dh_time.tv_sec))));
354353

lkcd_v8.c

+1-2
Original file line numberDiff line numberDiff line change
@@ -543,8 +543,7 @@ dump_lkcd_environment_v8(ulong arg)
543543
lkcd_print(" dh_num_pages: ");
544544
lkcd_print(BITS32() ? "%ld\n" : "%d\n", dh->dh_num_pages);
545545
lkcd_print(" dh_panic_string: %s%s", dh->dh_panic_string,
546-
dh && dh->dh_panic_string &&
547-
strstr(dh->dh_panic_string, "\n") ? "" : "\n");
546+
dh && strstr(dh->dh_panic_string, "\n") ? "" : "\n");
548547
tv.tv_sec = dh->dh_time.tv_sec;
549548
lkcd_print(" dh_time: %s\n",
550549
strip_linefeeds(ctime(&(tv.tv_sec))));

0 commit comments

Comments
 (0)