lkml.org 
[lkml]   [2019]   [Apr]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH v7 07/10] vsprintf: Consolidate handling of unknown pointer specifiers
On (04/17/19 13:53), Petr Mladek wrote:
[..]
> char *ip_addr_string(char *buf, char *end, const void *ptr,
> struct printf_spec spec, const char *fmt)
> {
> + char *err_fmt_msg;
> +
> switch (fmt[1]) {
> case '6':
> return ip6_addr_string(buf, end, ptr, spec, fmt);
> @@ -1457,7 +1459,8 @@ char *ip_addr_string(char *buf, char *end, const void *ptr,
> }}
> }
>
> - return ptr_to_id(buf, end, ptr, spec);
> + err_fmt_msg = fmt[0] == 'i' ? "(%pi?)" : "(%pI?)";
> + return string_nocheck(buf, end, err_fmt_msg, spec);
> }

We cannot err on fmt[0] here, can we. Both %pi and %pI are OK
and handled by pointer():

switch (fmt[0]) {
case 'I':
case 'i':
return ip_addr_string(buf, end, ptr, spec, fmt);


It's fmt[1] which can be unrecognized:

switch (fmt[1]) {
case '6':
case '4':
case 'S':
}

-ss

\
 
 \ /
  Last update: 2019-04-18 15:46    [W:0.146 / U:6.296 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site