linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Petr Mladek <pmladek@suse.com>
To: Joe Perches <coupons@perches.com>
Cc: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	LKML <linux-kernel@vger.kernel.org>,
	Steven Rostedt <rostedt@goodmis.org>
Subject: Re: RFC: script to convert vsprintf uses of %pf to %ps and %pF to %pS
Date: Fri, 30 Nov 2018 17:58:23 +0100	[thread overview]
Message-ID: <20181130165823.pmqw6l4fldfmwd2a@pathway.suse.cz> (raw)
In-Reply-To: <8eb7769cb8550e82105b71ba67fd603394e23b1e.camel@perches.com>

On Sun 2018-11-25 01:13:51, Joe Perches wrote:
> commit 04b8eb7a4ccd ("symbol lookup: introduce dereference_symbol_descriptor()}"
> 
> deprecated vsprintf extension %pf and %pF.
> 
> so a script to convert all the %pf uses to %ps and %pF uses to %pS
> could be useful.
> 
> There are a few files that appear should not be converted.
> 
> $ git grep -w --name-only -i '%pf'| \
>   grep -vP '^(?:Documentation|tools|include/linux/freezer.h)'| \
>   xargs sed -i -e 's/%pf/%ps/g' -e 's/%pF/%pS/g'
> 
> If that script above is run, it leaves the following patch
> to be applied:

> diff --git a/lib/vsprintf.c b/lib/vsprintf.c
> index 37a54a6dd594..393002bf5298 100644
> --- a/lib/vsprintf.c
> +++ b/lib/vsprintf.c
> @@ -1872,8 +1870,6 @@ char *pointer(const char *fmt, char *buf, char *end, void *ptr,
>  	}
>  
>  	switch (*fmt) {
> -	case 'F':
> -	case 'f':

Please, keep handling these modifiers so that they do not get reused
anytime soon.

The pointer modifiers are evil. Any misuse can easily lead to a crash.
Any mistakes with upstreaming 3rd party patches or backporting stable
fixes would be hard to notice.

Well, it is perfectly fine to just explicitly fallback to
the default %p behavior. I mean something like:

	case 'F':
	case 'f':
		/* Replaced by %ps and %pS and removed in 4.21 */
		break;

Best Regards,
Petr

      parent reply	other threads:[~2018-11-30 16:58 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-25  9:13 RFC: script to convert vsprintf uses of %pf to %ps and %pF to %pS Joe Perches
2018-11-26  5:35 ` Sergey Senozhatsky
2018-11-26  6:08   ` Sergey Senozhatsky
2018-11-26 17:13     ` Joe Perches
2018-11-30 16:58 ` Petr Mladek [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181130165823.pmqw6l4fldfmwd2a@pathway.suse.cz \
    --to=pmladek@suse.com \
    --cc=coupons@perches.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rostedt@goodmis.org \
    --cc=sergey.senozhatsky@gmail.com \
    --cc=torvalds@linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).