summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/test_printf.c9
-rw-r--r--lib/vsprintf.c8
2 files changed, 15 insertions, 2 deletions
diff --git a/lib/test_printf.c b/lib/test_printf.c
index d09993fca463..07309c45f327 100644
--- a/lib/test_printf.c
+++ b/lib/test_printf.c
@@ -609,10 +609,14 @@ page_flags_test(int section, int node, int zone, int last_cpupid,
char *cmp_buf)
{
unsigned long values[] = {section, node, zone, last_cpupid, kasan_tag};
- unsigned long size = 0;
+ unsigned long size;
bool append = false;
int i;
+ for (i = 0; i < ARRAY_SIZE(values); i++)
+ flags |= (values[i] & pft[i].mask) << pft[i].shift;
+
+ size = scnprintf(cmp_buf, BUF_SIZE, "%#lx(", flags);
if (flags & PAGEFLAGS_MASK) {
size += scnprintf(cmp_buf + size, BUF_SIZE - size, "%s", name);
append = true;
@@ -625,7 +629,6 @@ page_flags_test(int section, int node, int zone, int last_cpupid,
if (append)
size += scnprintf(cmp_buf + size, BUF_SIZE - size, "|");
- flags |= (values[i] & pft[i].mask) << pft[i].shift;
size += scnprintf(cmp_buf + size, BUF_SIZE - size, "%s=",
pft[i].name);
size += scnprintf(cmp_buf + size, BUF_SIZE - size, pft[i].fmt,
@@ -633,6 +636,8 @@ page_flags_test(int section, int node, int zone, int last_cpupid,
append = true;
}
+ snprintf(cmp_buf + size, BUF_SIZE - size, ")");
+
test(cmp_buf, "%pGp", &flags);
}
diff --git a/lib/vsprintf.c b/lib/vsprintf.c
index d7ad44f2c8f5..214098248610 100644
--- a/lib/vsprintf.c
+++ b/lib/vsprintf.c
@@ -2023,6 +2023,11 @@ char *format_page_flags(char *buf, char *end, unsigned long flags)
bool append = false;
int i;
+ buf = number(buf, end, flags, default_flag_spec);
+ if (buf < end)
+ *buf = '(';
+ buf++;
+
/* Page flags from the main area. */
if (main_flags) {
buf = format_flags(buf, end, main_flags, pageflag_names);
@@ -2051,6 +2056,9 @@ char *format_page_flags(char *buf, char *end, unsigned long flags)
append = true;
}
+ if (buf < end)
+ *buf = ')';
+ buf++;
return buf;
}