Commit 9a2fcad8 authored by Rasmus Villemoes's avatar Rasmus Villemoes Committed by Martin K. Petersen

osd: fix signed char versus %02x issue

If char is signed and one of these bytes happen to have a value outside
the ascii range, the corresponding output will consist of "ffffff"
followed by the two hex chars that were actually intended. One way to
fix it would be to change the casts to (u8*) aka
(unsigned char*), but it is much simpler (and generates smaller code)
to use the %ph extension which was created for such short hexdumps.
Signed-off-by: default avatarRasmus Villemoes <linux@rasmusvillemoes.dk>
Acked-by: default avatarBoaz Harrosh <ooo@electrozaur.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent f8aea701
...@@ -170,10 +170,7 @@ static int _osd_get_print_system_info(struct osd_dev *od, ...@@ -170,10 +170,7 @@ static int _osd_get_print_system_info(struct osd_dev *od,
/* FIXME: Where are the time utilities */ /* FIXME: Where are the time utilities */
pFirst = get_attrs[a++].val_ptr; pFirst = get_attrs[a++].val_ptr;
OSD_INFO("CLOCK [0x%02x%02x%02x%02x%02x%02x]\n", OSD_INFO("CLOCK [0x%6phN]\n", pFirst);
((char *)pFirst)[0], ((char *)pFirst)[1],
((char *)pFirst)[2], ((char *)pFirst)[3],
((char *)pFirst)[4], ((char *)pFirst)[5]);
if (a < nelem) { /* IBM-OSD-SIM bug, Might not have it */ if (a < nelem) { /* IBM-OSD-SIM bug, Might not have it */
unsigned len = get_attrs[a].len; unsigned len = get_attrs[a].len;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment