SMBIOS: are there any fields which hold be negative values?


Rebecca Cran
 

Before I send a patch, I wanted to check if anyone knew whether there are any fields in the SMBIOS specification which can be negative? I haven't across any, and the current code for smbiosview prints struct fields with "%d", which can cause large values (such as DIMM sizes) to be printed incorrectly.


--
Rebecca Cran


Laszlo Ersek
 

On 04/01/20 20:50, Rebecca Cran wrote:
Before I send a patch, I wanted to check if anyone knew whether there
are any fields in the SMBIOS specification which can be negative? I
haven't across any, and the current code for smbiosview prints struct
fields with "%d", which can cause large values (such as DIMM sizes) to
be printed incorrectly.
I agree only %u / %x, and %lu / %lx should be used, for printing DWORD
and QWORD fields from SMBIOS tables (respectively). WORD and BYTE are
fine to print with %d, if the output should be decimal.

Thanks
Laszlo