On 24/07/2019 14.05, Yann Droneaud wrote: > Hi, > > Beware that snprintf(), per C standard, is supposed to return the > length of the formatted string, regarless of the size of the > destination buffer. > > So encouraging developper to write something like code below because > snprintf() in kernel behave in a non-standard way, The kernel's snprintf() does not behave in a non-standard way, at least not with respect to its return value. It doesn't support %n or floating point, of course, and there are some quirks regarding precision (see lib/test_printf.c for details). There's the non-standard scnprintf() for getting the length of the formatted string, which can safely be used in an append loop. Or one can use the seq_buf API. Rasmus