lkml.org 
[lkml]   [2018]   [Nov]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: RFC: script to convert vsprintf uses of %pf to %ps and %pF to %pS
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

\
 
 \ /
  Last update: 2018-11-30 17:58    [W:0.100 / U:42.964 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site