Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1508993843.10651.22.camel@perches.com>
Date: Wed, 25 Oct 2017 21:57:23 -0700
From: Joe Perches <joe@...ches.com>
To: "Tobin C. Harding" <me@...in.cc>, kernel-hardening@...ts.openwall.com
Cc: "Jason A. Donenfeld" <Jason@...c4.com>, Theodore Ts'o <tytso@....edu>, 
 Linus Torvalds <torvalds@...ux-foundation.org>, Kees Cook
 <keescook@...omium.org>, Paolo Bonzini <pbonzini@...hat.com>, Tycho
 Andersen <tycho@...ker.com>, "Roberts, William C"
 <william.c.roberts@...el.com>, Tejun Heo <tj@...nel.org>, Jordan Glover
 <Golden_Miller83@...tonmail.ch>, Greg KH <gregkh@...uxfoundation.org>, Petr
 Mladek <pmladek@...e.com>, Ian Campbell <ijc@...lion.org.uk>, Sergey
 Senozhatsky <sergey.senozhatsky@...il.com>, Catalin Marinas
 <catalin.marinas@....com>,  Will Deacon <wilal.deacon@....com>, Steven
 Rostedt <rostedt@...dmis.org>, Chris Fries <cfries@...gle.com>,  Dave
 Weinstein <olorin@...gle.com>, Daniel Micay <danielmicay@...il.com>, Djalal
 Harouni <tixxdz@...il.com>,  linux-kernel@...r.kernel.org
Subject: Re: [PATCH V8 1/2] printk: remove tabular output for NULL pointer

On Thu, 2017-10-26 at 13:53 +1100, Tobin C. Harding wrote:
> Currently pointer() checks for a NULL pointer argument and then if so
> attempts to print "(null)" with _some_ standard width. This width cannot
> correctly be ascertained here because many of the printk specifiers
> print pointers of varying widths.

I believe this is not a good change.
Only pointers without a <foo> extension call pointer()

> Remove the attempt to print NULL pointers with a correct width.

the correct width for a %p is the default width.
The correct width for %p<foo> is unknown.

> Signed-off-by: Tobin C. Harding <me@...in.cc>
> ---
>  lib/vsprintf.c | 9 +--------
>  1 file changed, 1 insertion(+), 8 deletions(-)
> 
> diff --git a/lib/vsprintf.c b/lib/vsprintf.c
> index 86c3385b9eb3..16a587aed40e 100644
> --- a/lib/vsprintf.c
> +++ b/lib/vsprintf.c
> @@ -1710,15 +1710,8 @@ char *pointer(const char *fmt, char *buf, char *end, void *ptr,
>  {
>  	const int default_width = 2 * sizeof(void *);
>  
> -	if (!ptr && *fmt != 'K') {
> -		/*
> -		 * Print (null) with the same width as a pointer so it makes
> -		 * tabular output look nice.
> -		 */
> -		if (spec.field_width == -1)
> -			spec.field_width = default_width;
> +	if (!ptr && *fmt != 'K')
>  		return string(buf, end, "(null)", spec);
> -	}
>  
>  	switch (*fmt) {
>  	case 'F':

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.