Blame SOURCES/0021-Fix-gcc-12-compiler-warnings-on-lkcd_-.c.patch

3ce5e9
From a4f8fe965e1ed0d27aff0cdf30e2c571da2e5356 Mon Sep 17 00:00:00 2001
3ce5e9
From: Kazuhito Hagio <k-hagio-ab@nec.com>
3ce5e9
Date: Thu, 1 Sep 2022 14:03:09 +0900
3ce5e9
Subject: [PATCH 21/28] Fix gcc-12 compiler warnings on lkcd_*.c
3ce5e9
3ce5e9
Without the patch, the following gcc-12 compiler warnings are emitted
3ce5e9
for lkcd_*.c:
3ce5e9
3ce5e9
lkcd_v1.c: In function 'dump_lkcd_environment_v1':
3ce5e9
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]
3ce5e9
  252 |                 dh && dh->dh_panic_string &&
3ce5e9
      |                    ^~
3ce5e9
In file included from lkcd_v1.c:21:
3ce5e9
lkcd_vmdump_v1.h:108:30: note: 'dh_panic_string' declared here
3ce5e9
  108 |         char                 dh_panic_string[DUMP_PANIC_LEN];
3ce5e9
      |                              ^~~~~~~~~~~~~~~
3ce5e9
...
3ce5e9
3ce5e9
Reported-by: Lianbo Jiang <lijiang@redhat.com>
3ce5e9
Signed-off-by: Kazuhito Hagio <k-hagio-ab@nec.com>
3ce5e9
Signed-off-by: Lianbo Jiang <lijiang@redhat.com>
3ce5e9
---
3ce5e9
 lkcd_v1.c    | 3 +--
3ce5e9
 lkcd_v2_v3.c | 3 +--
3ce5e9
 lkcd_v5.c    | 3 +--
3ce5e9
 lkcd_v7.c    | 3 +--
3ce5e9
 lkcd_v8.c    | 3 +--
3ce5e9
 5 files changed, 5 insertions(+), 10 deletions(-)
3ce5e9
3ce5e9
diff --git a/lkcd_v1.c b/lkcd_v1.c
3ce5e9
index 5f891aeb1ce3..31bdc04c5fdd 100644
3ce5e9
--- a/lkcd_v1.c
3ce5e9
+++ b/lkcd_v1.c
3ce5e9
@@ -249,8 +249,7 @@ dump_header_only:
3ce5e9
         lkcd_print("          dh_eip: %lx\n", dh->dh_eip);
3ce5e9
 	lkcd_print("    dh_num_pages: %d\n", dh->dh_num_pages);
3ce5e9
         lkcd_print(" dh_panic_string: %s%s", dh->dh_panic_string,
3ce5e9
-		dh && dh->dh_panic_string &&
3ce5e9
-		strstr(dh->dh_panic_string, "\n") ? "" : "\n");
3ce5e9
+		dh && strstr(dh->dh_panic_string, "\n") ? "" : "\n");
3ce5e9
         lkcd_print("         dh_time: %s\n",
3ce5e9
                         strip_linefeeds(ctime(&(dh->dh_time.tv_sec))));
3ce5e9
 
3ce5e9
diff --git a/lkcd_v2_v3.c b/lkcd_v2_v3.c
3ce5e9
index 8635a7b07c77..edcb6637a55e 100644
3ce5e9
--- a/lkcd_v2_v3.c
3ce5e9
+++ b/lkcd_v2_v3.c
3ce5e9
@@ -307,8 +307,7 @@ dump_header_only:
3ce5e9
 	lkcd_print("    dh_num_pages: ");
3ce5e9
 	lkcd_print(BITS32() ? "%ld\n" : "%d\n", dh->dh_num_pages);
3ce5e9
         lkcd_print(" dh_panic_string: %s%s", dh->dh_panic_string,
3ce5e9
-		dh && dh->dh_panic_string &&
3ce5e9
-		strstr(dh->dh_panic_string, "\n") ? "" : "\n");
3ce5e9
+		dh && strstr(dh->dh_panic_string, "\n") ? "" : "\n");
3ce5e9
         lkcd_print("         dh_time: %s\n",
3ce5e9
                         strip_linefeeds(ctime(&(dh->dh_time.tv_sec))));
3ce5e9
 
3ce5e9
diff --git a/lkcd_v5.c b/lkcd_v5.c
3ce5e9
index cb7634d094ec..e3bfa6f4b272 100644
3ce5e9
--- a/lkcd_v5.c
3ce5e9
+++ b/lkcd_v5.c
3ce5e9
@@ -270,8 +270,7 @@ dump_header_only:
3ce5e9
 	lkcd_print("    dh_num_pages: ");
3ce5e9
 	lkcd_print(BITS32() ? "%ld\n" : "%d\n", dh->dh_num_pages);
3ce5e9
         lkcd_print(" dh_panic_string: %s%s", dh->dh_panic_string,
3ce5e9
-		dh && dh->dh_panic_string &&
3ce5e9
-		strstr(dh->dh_panic_string, "\n") ? "" : "\n");
3ce5e9
+		dh && strstr(dh->dh_panic_string, "\n") ? "" : "\n");
3ce5e9
         lkcd_print("         dh_time: %s\n",
3ce5e9
                         strip_linefeeds(ctime(&(dh->dh_time.tv_sec))));
3ce5e9
 
3ce5e9
diff --git a/lkcd_v7.c b/lkcd_v7.c
3ce5e9
index 608e1481f01d..97d99008635a 100644
3ce5e9
--- a/lkcd_v7.c
3ce5e9
+++ b/lkcd_v7.c
3ce5e9
@@ -347,8 +347,7 @@ dump_header_only:
3ce5e9
 	lkcd_print("    dh_num_pages: ");
3ce5e9
 	lkcd_print(BITS32() ? "%ld\n" : "%d\n", dh->dh_num_pages);
3ce5e9
         lkcd_print(" dh_panic_string: %s%s", dh->dh_panic_string,
3ce5e9
-		dh && dh->dh_panic_string &&
3ce5e9
-		strstr(dh->dh_panic_string, "\n") ? "" : "\n");
3ce5e9
+		dh && strstr(dh->dh_panic_string, "\n") ? "" : "\n");
3ce5e9
         lkcd_print("         dh_time: %s\n",
3ce5e9
                         strip_linefeeds(ctime(&(dh->dh_time.tv_sec))));
3ce5e9
 
3ce5e9
diff --git a/lkcd_v8.c b/lkcd_v8.c
3ce5e9
index 3b355e056123..4167fa5e4292 100644
3ce5e9
--- a/lkcd_v8.c
3ce5e9
+++ b/lkcd_v8.c
3ce5e9
@@ -543,8 +543,7 @@ dump_header_only:
3ce5e9
 	lkcd_print("    dh_num_pages: ");
3ce5e9
 	lkcd_print(BITS32() ? "%ld\n" : "%d\n", dh->dh_num_pages);
3ce5e9
         lkcd_print(" dh_panic_string: %s%s", dh->dh_panic_string,
3ce5e9
-		dh && dh->dh_panic_string &&
3ce5e9
-		strstr(dh->dh_panic_string, "\n") ? "" : "\n");
3ce5e9
+		dh && strstr(dh->dh_panic_string, "\n") ? "" : "\n");
3ce5e9
 	tv.tv_sec = dh->dh_time.tv_sec;
3ce5e9
         lkcd_print("         dh_time: %s\n",
3ce5e9
                         strip_linefeeds(ctime(&(tv.tv_sec))));
3ce5e9
-- 
3ce5e9
2.37.1
3ce5e9