Skip to content

Commit a25a085

Browse files
Matthew Wilcox (Oracle)pmladek
authored andcommitted
test_printf: Remove separate page_flags variable
Keep flags intact so that we also test what happens when unknown flags are passed to %pGp. Signed-off-by: Matthew Wilcox (Oracle) <[email protected]> Reviewed-by: Yafang Shao <[email protected]> Reviewed-by: Petr Mladek <[email protected]> Signed-off-by: Petr Mladek <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent c666d44 commit a25a085

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

lib/test_printf.c

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -605,17 +605,15 @@ static const struct page_flags_test pft[] = {
605605

606606
static void __init
607607
page_flags_test(int section, int node, int zone, int last_cpupid,
608-
int kasan_tag, int flags, const char *name, char *cmp_buf)
608+
int kasan_tag, unsigned long flags, const char *name,
609+
char *cmp_buf)
609610
{
610611
unsigned long values[] = {section, node, zone, last_cpupid, kasan_tag};
611-
unsigned long page_flags = 0;
612612
unsigned long size = 0;
613613
bool append = false;
614614
int i;
615615

616-
flags &= PAGEFLAGS_MASK;
617-
if (flags) {
618-
page_flags |= flags;
616+
if (flags & PAGEFLAGS_MASK) {
619617
snprintf(cmp_buf + size, BUF_SIZE - size, "%s", name);
620618
size = strlen(cmp_buf);
621619
#if SECTIONS_WIDTH || NODES_WIDTH || ZONES_WIDTH || \
@@ -635,7 +633,7 @@ page_flags_test(int section, int node, int zone, int last_cpupid,
635633
size = strlen(cmp_buf);
636634
}
637635

638-
page_flags |= (values[i] & pft[i].mask) << pft[i].shift;
636+
flags |= (values[i] & pft[i].mask) << pft[i].shift;
639637
snprintf(cmp_buf + size, BUF_SIZE - size, "%s=", pft[i].name);
640638
size = strlen(cmp_buf);
641639
snprintf(cmp_buf + size, BUF_SIZE - size, pft[i].fmt,
@@ -644,7 +642,7 @@ page_flags_test(int section, int node, int zone, int last_cpupid,
644642
append = true;
645643
}
646644

647-
test(cmp_buf, "%pGp", &page_flags);
645+
test(cmp_buf, "%pGp", &flags);
648646
}
649647

650648
static void __init

0 commit comments

Comments
 (0)