Skip to contentSkip to conversation

printk format "%4.4s"

DISCUSSION shinkoi2005a 2 participants 2 messages Sep 17, 2007

lore
Share & tools
lore
#0 lore raw

Hi, all

I have a question about printk format.

Can printk format use "%4.4s"?
This format is used following source.

#############
drivers/acpi/tables/tbinstal.c
ACPI_ERROR((AE_INFO,
"Table has invalid signature [%4.4s], must be SSDT, PSDT or OEMx", table_desc->pointer->signature));

##############
At least, my dmesg is buggy output like that..

##############

$ dmesg
(snip)
ACPI Warning (tbutils-0158): Incorrect checksum in table [  ^E礑 -  00, should b
e F6 [20070126]
ACPI Error (tbinstal-0134): Table has invalid signature [  ^E礑, must be SSDT, P
SDT or OEMx [20070126]
(snip)
##############
#1 lore raw
Quoted 5 lines · On Sep 17, 2007, 2:57 +0200, shinkoi2005a <[email protected]> wrote:

Hi, all

I have a question about printk format.

Can printk format use "%4.4s"?

Yes it can.
The precision part of the format determines the max number of characters to copy from the string.
The 4 byte signature array might not null terminated so you must use the .4 in the format otherwise vsnprintf might look over the buffer for the terminating '\0'.

Quoted 10 lines

This format is used following source.

#############
drivers/acpi/tables/tbinstal.c
ACPI_ERROR((AE_INFO,
"Table has invalid signature [%4.4s], must be SSDT, PSDT or OEMx", table_desc->pointer->signature));

##############
At least, my dmesg is buggy output like that..

Hmm, looks like you should believe the error messages rather than blaming the code for buggy output ;-)

Like it says, the table seems corrupt, has invalid signature and checksum.

Quoted 17 lines

##############

$ dmesg
(snip)
ACPI Warning (tbutils-0158): Incorrect checksum in table [  ^E礑 -  00, should b
e F6 [20070126]
ACPI Error (tbinstal-0134): Table has invalid signature [  ^E礑, must be SSDT, P
SDT or OEMx [20070126]
(snip)
##############

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/