]> git.karo-electronics.de Git - karo-tx-linux.git/commit
coredump: cn_vprintf() has no reason to call vsnprintf() twice
authorOleg Nesterov <oleg@redhat.com>
Wed, 19 Jun 2013 00:08:18 +0000 (10:08 +1000)
committerStephen Rothwell <sfr@canb.auug.org.au>
Wed, 19 Jun 2013 07:27:40 +0000 (17:27 +1000)
commitf2e905144609a59985e266ff9c27028d2509dd7f
tree11229b79a327010816e1b817c3e6f64e480cb7ce
parentbcf13e37a454fe2112d342526d6bc55056656f05
coredump: cn_vprintf() has no reason to call vsnprintf() twice

cn_vprintf() looks really overcomplicated and sub-optimal.  We do not need
vsnprintf(NULL) to calculate the size we need, we can simply try to print
into the current buffer and expand/retry only if necessary.

Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Cc: Andi Kleen <andi@firstfloor.org>
Cc: Colin Walters <walters@verbum.org>
Cc: Denys Vlasenko <vda.linux@googlemail.com>
Cc: Jiri Slaby <jslaby@suse.cz>
Cc: Lennart Poettering <mzxreary@0pointer.de>
Cc: Lucas De Marchi <lucas.de.marchi@gmail.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
fs/coredump.c