Re: [PATCH] vsprintf: Make %pGp print the hex value

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Oct 12, 2021 at 11:55:50AM +0200, Rasmus Villemoes wrote:
> On 08/10/2021 21.38, Matthew Wilcox (Oracle) wrote:
> > All existing users of %pGp want the hex value as well as the decoded
> > flag names.  This looks awkward (passing the same parameter to printf
> > twice), so move that functionality into the core.  If we want, we
> > can make that optional with flag arguments to %pGp in the future.
> > 
> > Signed-off-by: Matthew Wilcox (Oracle) <willy@xxxxxxxxxxxxx>
> > ---
> >  lib/test_printf.c   | 2 ++
> >  lib/vsprintf.c      | 8 ++++++++
> >  mm/debug.c          | 2 +-
> >  mm/memory-failure.c | 8 ++++----
> >  mm/page_owner.c     | 4 ++--
> >  mm/slub.c           | 4 ++--
> >  6 files changed, 19 insertions(+), 9 deletions(-)
> > 
> > diff --git a/lib/test_printf.c b/lib/test_printf.c
> > index 55082432f37e..32d748d1ae02 100644
> > --- a/lib/test_printf.c
> > +++ b/lib/test_printf.c
> > @@ -614,6 +614,7 @@ page_flags_test(int section, int node, int zone, int last_cpupid,
> >  	bool append = false;
> >  	int i;
> >  
> > +	snprintf(cmp_buf + size, BUF_SIZE - size, "%x(", flags);
> 
> This generates the hex value without leading 0x, however...
> 
> > +	buf = number(buf, end, flags, default_flag_spec);
> 
> ...default_flag_spec has '.flags = SPECIAL | SMALL,', i.e. what one
> would get from %#x . I'm guessing that's what upsets 0-day.
> 
> Geez it would be nice if 0day actually reported the "Expected foo, but
> bar was emitted to the buffer".

Wait, I built a kernel with TEST_PRINTF and booted it.  That doesn't
run the tests at boot time?  Sure would be nice if the Kconfig help text
said what you had to do to actually run the self-test.




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux