Blame SOURCES/0011-Fix-gcc-11-compiler-warning-on-symbols.c.patch

56ae9b
From 98484914b7f4ba34da0625baa0ed6d449c1fa3ad Mon Sep 17 00:00:00 2001
56ae9b
From: Kazuhito Hagio <k-hagio-ab@nec.com>
56ae9b
Date: Fri, 22 Jul 2022 13:44:50 +0900
56ae9b
Subject: [PATCH 11/28] Fix gcc-11 compiler warning on symbols.c
56ae9b
56ae9b
Without the patch, the following gcc-11 compiler warning is emitted for
56ae9b
symbols.c:
56ae9b
56ae9b
symbols.c: In function 'cmd_p':
56ae9b
symbols.c:7412:38: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
56ae9b
 7412 |                         *(cpuspec-1) = ':';
56ae9b
      |                         ~~~~~~~~~~~~~^~~~~
56ae9b
56ae9b
Signed-off-by: Kazuhito Hagio <k-hagio-ab@nec.com>
56ae9b
Signed-off-by: Lianbo Jiang <lijiang@redhat.com>
56ae9b
---
56ae9b
 symbols.c | 6 +++---
56ae9b
 1 file changed, 3 insertions(+), 3 deletions(-)
56ae9b
56ae9b
diff --git a/symbols.c b/symbols.c
56ae9b
index 69004a2e66e3..a94660538492 100644
56ae9b
--- a/symbols.c
56ae9b
+++ b/symbols.c
56ae9b
@@ -7363,7 +7363,7 @@ cmd_p(void)
56ae9b
 	unsigned radix;
56ae9b
 	int do_load_module_filter;
56ae9b
 	char buf1[BUFSIZE]; 
56ae9b
-	char *cpuspec;
56ae9b
+	char *cpuspec, *p;
56ae9b
 
56ae9b
 	do_load_module_filter = radix = 0;
56ae9b
 
56ae9b
@@ -7398,7 +7398,7 @@ cmd_p(void)
56ae9b
         if (argerrs || !args[optind])
56ae9b
                 cmd_usage(pc->curcmd, SYNOPSIS);
56ae9b
 
56ae9b
-	cpuspec = strrchr(args[optind], ':');
56ae9b
+	p = cpuspec = strrchr(args[optind], ':');
56ae9b
 	if (cpuspec)
56ae9b
 		*cpuspec++ = NULLCHAR;
56ae9b
 
56ae9b
@@ -7421,7 +7421,7 @@ cmd_p(void)
56ae9b
 			      sp->name);
56ae9b
 		else
56ae9b
 			/* maybe a valid C expression (e.g. ':') */
56ae9b
-			*(cpuspec-1) = ':';
56ae9b
+			*p = ':';
56ae9b
 	}
56ae9b
 
56ae9b
 	process_gdb_output(concat_args(buf1, 0, TRUE), radix,
56ae9b
-- 
56ae9b
2.37.1
56ae9b