[patch] PS3: Fix printing of os-area magic numbers
Geert Uytterhoeven
Geert.Uytterhoeven at sonycom.com
Sun Nov 18 20:33:29 EST 2007
On Sat, 17 Nov 2007, Geoff Levand wrote:
> Fix a bug in the printing of the PS3 os-area magic numbers which assumed that
> magic numbers were zero terminated strings. The magic numbers are represented
> in memory as integers. If the os-area sections are not initialized correctly
> they could contained random data that would be printed to the display.
>
> CC: Geert Uytterhoeven <Geert.Uytterhoeven at sonycom.com>
> Signed-off-by: Geoff Levand <geoffrey.levand at am.sony.com>
> ---
>
> Paul,
>
> This fixes a very minor bug in linus' current tree. Please consider
> for 2.6.24.
>
> -Geoff
>
> arch/powerpc/platforms/ps3/os-area.c | 14 ++++++++++++--
> 1 file changed, 12 insertions(+), 2 deletions(-)
>
> --- a/arch/powerpc/platforms/ps3/os-area.c
> +++ b/arch/powerpc/platforms/ps3/os-area.c
> @@ -269,8 +269,13 @@ static void __init os_area_get_property(
> static void _dump_header(const struct os_area_header *h, const char *func,
> int line)
> {
> + u8 str[sizeof(h->magic_num) + 1];
> +
> + memcpy(str, h->magic_num, sizeof(h->magic_num));
> + str[sizeof(h->magic_num)] = 0;
> +
> pr_debug("%s:%d: h.magic_num: '%s'\n", func, line,
> - h->magic_num);
> + str);
This only fixes the problem of a missing zero-termination (which could be
handled using `%*s').
I'm also worried about unprintable characters.
With kind regards,
Geert Uytterhoeven
Software Architect
Sony Network and Software Technology Center Europe
The Corporate Village · Da Vincilaan 7-D1 · B-1935 Zaventem · Belgium
Phone: +32 (0)2 700 8453
Fax: +32 (0)2 700 8622
E-mail: Geert.Uytterhoeven at sonycom.com
Internet: http://www.sony-europe.com/
Sony Network and Software Technology Center Europe
A division of Sony Service Centre (Europe) N.V.
Registered office: Technologielaan 7 · B-1840 Londerzeel · Belgium
VAT BE 0413.825.160 · RPR Brussels
Fortis Bank Zaventem · Swift GEBABEBB08A · IBAN BE39001382358619
More information about the Linuxppc-dev
mailing list