Message ID | 20211019142621.2810043-3-willy@infradead.org (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | Improvements to %pGp | expand |
On Tue, Oct 19, 2021 at 10:30 PM Matthew Wilcox (Oracle) <willy@infradead.org> wrote: > > Keep flags intact so that we also test what happens when unknown flags > are passed to %pGp. > > Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org> Reviewed-by: Yafang Shao <laoar.shao@gmail.com> > --- > lib/test_printf.c | 12 +++++------- > 1 file changed, 5 insertions(+), 7 deletions(-) > > diff --git a/lib/test_printf.c b/lib/test_printf.c > index a52c1c3a55ba..4531063afd45 100644 > --- a/lib/test_printf.c > +++ b/lib/test_printf.c > @@ -605,17 +605,15 @@ static const struct page_flags_test pft[] = { > > static void __init > page_flags_test(int section, int node, int zone, int last_cpupid, > - int kasan_tag, int flags, const char *name, char *cmp_buf) > + int kasan_tag, unsigned long flags, const char *name, > + char *cmp_buf) > { > unsigned long values[] = {section, node, zone, last_cpupid, kasan_tag}; > - unsigned long page_flags = 0; > unsigned long size = 0; > bool append = false; > int i; > > - flags &= PAGEFLAGS_MASK; > - if (flags) { > - page_flags |= flags; > + if (flags & PAGEFLAGS_MASK) { > snprintf(cmp_buf + size, BUF_SIZE - size, "%s", name); > size = strlen(cmp_buf); > #if SECTIONS_WIDTH || NODES_WIDTH || ZONES_WIDTH || \ > @@ -635,7 +633,7 @@ page_flags_test(int section, int node, int zone, int last_cpupid, > size = strlen(cmp_buf); > } > > - page_flags |= (values[i] & pft[i].mask) << pft[i].shift; > + flags |= (values[i] & pft[i].mask) << pft[i].shift; > snprintf(cmp_buf + size, BUF_SIZE - size, "%s=", pft[i].name); > size = strlen(cmp_buf); > 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, > append = true; > } > > - test(cmp_buf, "%pGp", &page_flags); > + test(cmp_buf, "%pGp", &flags); > } > > static void __init > -- > 2.32.0 >
On Tue 2021-10-19 15:26:18, Matthew Wilcox (Oracle) wrote: > Keep flags intact so that we also test what happens when unknown flags > are passed to %pGp. > > Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org> Reviewed-by: Petr Mladek <pmladek@suse.com> Best Regards, Petr
diff --git a/lib/test_printf.c b/lib/test_printf.c index a52c1c3a55ba..4531063afd45 100644 --- a/lib/test_printf.c +++ b/lib/test_printf.c @@ -605,17 +605,15 @@ static const struct page_flags_test pft[] = { static void __init page_flags_test(int section, int node, int zone, int last_cpupid, - int kasan_tag, int flags, const char *name, char *cmp_buf) + int kasan_tag, unsigned long flags, const char *name, + char *cmp_buf) { unsigned long values[] = {section, node, zone, last_cpupid, kasan_tag}; - unsigned long page_flags = 0; unsigned long size = 0; bool append = false; int i; - flags &= PAGEFLAGS_MASK; - if (flags) { - page_flags |= flags; + if (flags & PAGEFLAGS_MASK) { snprintf(cmp_buf + size, BUF_SIZE - size, "%s", name); size = strlen(cmp_buf); #if SECTIONS_WIDTH || NODES_WIDTH || ZONES_WIDTH || \ @@ -635,7 +633,7 @@ page_flags_test(int section, int node, int zone, int last_cpupid, size = strlen(cmp_buf); } - page_flags |= (values[i] & pft[i].mask) << pft[i].shift; + flags |= (values[i] & pft[i].mask) << pft[i].shift; snprintf(cmp_buf + size, BUF_SIZE - size, "%s=", pft[i].name); size = strlen(cmp_buf); 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, append = true; } - test(cmp_buf, "%pGp", &page_flags); + test(cmp_buf, "%pGp", &flags); } static void __init
Keep flags intact so that we also test what happens when unknown flags are passed to %pGp. Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org> --- lib/test_printf.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-)