Re: [PATCH v2 04/10] lib/vsprintf: add %*pE[achnops] format specifier

From
Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Date
2014-07-08 08:24:45
Also in
lkml
Reply to
Joe Perches, 2014-07-07
On Mon, 2014-07-07 at 09:50 -0700, Joe Perches wrote:
On Mon, 2014-07-07 at 18:21 +0300, Andy Shevchenko wrote:
quoted
diff --git a/lib/vsprintf.c b/lib/vsprintf.c
[]
quoted
 static noinline_for_stack
+char *escaped_string(char *buf, char *end, u8 *addr, struct printf_spec spec,
+		     const char *fmt)
[]
quoted
+	if (spec.field_width == 0)
+		/* nothing to print */
+		return buf;
[]
quoted
+	len = spec.field_width < 0 ? 1 : spec.field_width;
If field_width is not specified, emit a single byte?
A single byte to be escaped (it might be \000, for example, on output).
Perhaps better if -1 was accepted by string_escape_mem
as a strlen request or just ignored as a 0 length is
above.
Would it be any benefit here?
fyi: hex_string emits nothing on printk("%ph", buf);
Works just fine. How did you check it?

pr_info("%ph\n", in); => test_string_helpers: 1b

(I suppose "\n" flushes a buffer for me.)

-- 
Andy Shevchenko [off-list ref]
Intel Finland Oy
Thread (16 messages) 16 messages, 2 authors, last reply 2014-07-08
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help