]> git.kernelconcepts.de Git - karo-tx-linux.git/commit
lib/vsprintf.c: reduce stack use in number()
authorRasmus Villemoes <linux@rasmusvillemoes.dk>
Wed, 15 Apr 2015 23:17:05 +0000 (16:17 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Wed, 15 Apr 2015 23:35:23 +0000 (16:35 -0700)
commite26c12c777118d65aeb97eb1651338e7decae80e
tree55300d96e94c3e9efdaf434b8473ccc02536ba7d
parent51be17dfff753e72872f096ce1e654734f2fec50
lib/vsprintf.c: reduce stack use in number()

At least since the initial git commit, when base was passed as a separate
parameter, number() has only been called with bases 8, 10 and 16.  I'm
guessing that 66 was to accommodate 64 0/1, a sign and a '\0', but the
buffer is only used for the actual digits.  Octal digits carry 3 bits of
information, so 24 is enough.  Spell that 3*sizeof(num) so one less place
needs to be changed should long long ever be 128 bits.  Also remove the
commented-out code that would handle an arbitrary base.

Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Tejun Heo <tj@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
lib/vsprintf.c