initcalls: Fix m68k build and possible buffer overflow

This patch fixes a build bug on m68k - gcc decides to emit a call to the
strlen library function, which we don't implement.

More importantly - my previous patch "init: don't lose initcall return
values" (commit e662e1cfd434aa234b72fbc781f1d70211cb785b) had introduced
potential buffer overflow by wrong calculation of string accumulator
size.

Use strlcat() instead, fixing both bugs.

Many thanks Andreas Schwab and Geert Uytterhoeven for helping
to catch and fix the bug.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by Cyrill Gorcunov and committed by Linus Torvalds a76bfd0d e0df154f

+3 -3
+3 -3
init/main.c
··· 697 { 698 int count = preempt_count(); 699 ktime_t t0, t1, delta; 700 - char msgbuf[40]; 701 int result; 702 703 if (initcall_debug) { ··· 722 sprintf(msgbuf, "error code %d ", result); 723 724 if (preempt_count() != count) { 725 - strncat(msgbuf, "preemption imbalance ", sizeof(msgbuf)); 726 preempt_count() = count; 727 } 728 if (irqs_disabled()) { 729 - strncat(msgbuf, "disabled interrupts ", sizeof(msgbuf)); 730 local_irq_enable(); 731 } 732 if (msgbuf[0]) {
··· 697 { 698 int count = preempt_count(); 699 ktime_t t0, t1, delta; 700 + char msgbuf[64]; 701 int result; 702 703 if (initcall_debug) { ··· 722 sprintf(msgbuf, "error code %d ", result); 723 724 if (preempt_count() != count) { 725 + strlcat(msgbuf, "preemption imbalance ", sizeof(msgbuf)); 726 preempt_count() = count; 727 } 728 if (irqs_disabled()) { 729 + strlcat(msgbuf, "disabled interrupts ", sizeof(msgbuf)); 730 local_irq_enable(); 731 } 732 if (msgbuf[0]) {