lists.openwall.net | lists / announce owl-users owl-dev john-users john-dev passwdqc-users yescrypt popa3d-users / oss-security kernel-hardening musl sabotage tlsify passwords / crypt-dev xvendor / Bugtraq Full-Disclosure linux-kernel linux-netdev linux-ext4 linux-hardening PHC | |
Open Source and information security mailing list archives
| ||
|
Date: Sat, 29 Dec 2012 19:07:48 -0800 From: Joe Perches <joe@...ches.com> To: Roland Dreier <roland@...estorage.com>, Peter Zijlstra <a.p.zijlstra@...llo.nl>, Paul Mackerras <paulus@...ba.org>, Ingo Molnar <mingo@...hat.com>, Arnaldo Carvalho de Melo <acme@...stprotocols.net> Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>, Sylvain Munaut <s.munaut@...tever-company.com>, Kay Sievers <kay@...y.org>, Andrew Morton <akpm@...ux-foundation.org>, LKML <linux-kernel@...r.kernel.org> Subject: Re: [PATCH] printk: Fix incorrect length from print_time() when seconds > 99999 On Sat, 2012-12-29 at 14:27 -0800, Roland Dreier wrote: > On Sat, Dec 29, 2012 at 12:08 PM, Joe Perches <joe@...ches.com> wrote: > > Sylvan Munaut did something similar > > https://lkml.org/lkml/2012/12/5/168 > > Missed that and duplicated the debugging :( > Sorry Sylvain. > > I guess my patch may be preferable, since I happened to use the snprintf() > method that you suggest -- all the open-coded digit-counting seems a bit > verbose and perhaps hard to read and see the equivalence to the sprintf. the kernel implementation of snprint/vsnprintf does expand on c99 and allow snprintf(NULL, 0... so your code should work fine. I think the snprintf(NULL, 0 might be suspect. (the same form is already used in drivers/usb/gadget/composite.c) man snprintf says in part: Concerning the return value of snprintf(), SUSv2 and C99 contradict each other: when snprintf() is called with size=0 then SUSv2 stipulates an unspecified return value less than 1, while C99 allows str to be NULL in this case, and gives the return value (as always) as the number of characters that would have been written in case the output string has been large enough. If not here, maybe the tools/perf/util/values.c code that uses the same form might need changing. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@...r.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists