[SeaBIOS] SMBIOS strings

Jes Sorensen Jes.Sorensen at redhat.com
Wed Jun 2 08:44:42 CEST 2010

On 06/01/10 22:26, Sebastian Herbszt wrote:
> Jes Sorensen wrote:
>> Handle 0x0401, DMI type 4, 32 bytes
>> Processor Information
>> -       Socket Designation: CPU 1
>> +       Socket Designation: CPU01
> smbios.c got
> snprintf((char*)start, 6, "CPU%2x", cpu_number);
> It should print "CPU 1" instead of "CPU01" because the
> padding should be done with spaces not zeros. Maybe
> bvprintf() doesn't handle it correctly?

I looked at the man page for snprintf() and it isn't clear to me that it
is required to space pad when printing hex numbers.

Having looked at the other pieces, I think this is probably the only one
we might want to change. It should be pretty easy to just do something like:

if (cpu_number < 0x10)
	snprintf("CPU %x", cpu_number);
	snprintf("CPU%2x", cpu_number);

Esthetically I think this would be prettier, but question is whether
it's something to worry about or not.


More information about the SeaBIOS mailing list