Skip to content

Commit

Permalink
kernel/panic.c: reduce 1 byte usage for print tainted buffer
Browse files Browse the repository at this point in the history
sizeof("Tainted: ") already counts '\0', and after first sprintf(), 's'
will start from the current string end (its' value is '\0').

So need not add additional 1 byte for maximized usage of 'buf' in
print_tainted().

Signed-off-by: Chen Gang <gang.chen@asianux.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Chen Gang authored and torvalds committed Nov 13, 2013
1 parent 1931d43 commit 0128476
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion kernel/panic.c
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ static const struct tnt tnts[] = {
*/
const char *print_tainted(void)
{
static char buf[ARRAY_SIZE(tnts) + sizeof("Tainted: ") + 1];
static char buf[ARRAY_SIZE(tnts) + sizeof("Tainted: ")];

if (tainted_mask) {
char *s;
Expand Down

0 comments on commit 0128476

Please sign in to comment.