Blame SOURCES/0027-Fix-segmentation-fault-in-page_flags_init_from_pagef.patch

56ae9b
From cdcf2d3f4c69ffa8a29b70120ee4fca6e390123b Mon Sep 17 00:00:00 2001
56ae9b
From: Matias Ezequiel Vara Larsen <matiasevara@gmail.com>
56ae9b
Date: Mon, 24 Oct 2022 11:35:29 +0200
56ae9b
Subject: [PATCH 27/28] Fix segmentation fault in
56ae9b
 page_flags_init_from_pageflag_names()
56ae9b
56ae9b
When read_string() fails in page_flags_init_from_pageflag_names(),
56ae9b
error() dereferences the name variable to print the string that the
56ae9b
variable points to. However, name points to a string that is not in
56ae9b
crash's memory-space thus triggering a segmentation fault.
56ae9b
56ae9b
This patch replaces "%s" in the error message with "%lx" so the address
56ae9b
is printed instead.  Also replaces "%ld" for mask with "%lx".
56ae9b
56ae9b
[ kh: changed the conversion specifiers and commit message ]
56ae9b
56ae9b
Signed-off-by: Matias Ezequiel Vara Larsen <matias.vara@vates.fr>
56ae9b
Signed-off-by: Kazuhito Hagio <k-hagio-ab@nec.com>
56ae9b
Signed-off-by: Lianbo Jiang <lijiang@redhat.com>
56ae9b
---
56ae9b
 memory.c | 2 +-
56ae9b
 1 file changed, 1 insertion(+), 1 deletion(-)
56ae9b
56ae9b
diff --git a/memory.c b/memory.c
56ae9b
index ff6b571361eb..ddbf458277f0 100644
56ae9b
--- a/memory.c
56ae9b
+++ b/memory.c
56ae9b
@@ -6599,7 +6599,7 @@ page_flags_init_from_pageflag_names(void)
56ae9b
 		}
56ae9b
 
56ae9b
 		if (!read_string((ulong)name, namebuf, BUFSIZE-1)) {
56ae9b
-			error(INFO, "failed to read pageflag_names entry (i: %d  name: \"%s\"  mask: %ld)\n",
56ae9b
+			error(INFO, "failed to read pageflag_names entry (i: %d  name: %lx  mask: %lx)\n",
56ae9b
 				i, name, mask);
56ae9b
 			goto pageflags_fail;
56ae9b
 		}
56ae9b
-- 
56ae9b
2.37.1
56ae9b