hvmloader: change constants to hex format in size checks
PATCH 1/1 hvmloader: change constants to hex format in size checks
From: Petr Beneš <[email protected]>
Match the number format the specification gives.
No functional change.
--- tools/firmware/hvmloader/smbios.c | 32 +++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-)
tools/firmware/hvmloader/smbios.c +16 -16
@@ -647,7 +647,7 @@ smbios_type_3_init(void *start)* which corresponds with the end of the "Security Status" field. */ - BUILD_BUG_ON(endof_field(struct smbios_type_3, security_status) != 13); + BUILD_BUG_ON(endof_field(struct smbios_type_3, security_status) != 0x0d); next =smbios_pt_copy (start,3 ,SMBIOS_HANDLE_TYPE3 , offsetof(struct smbios_type_3 , security_status));
@@ -706,7 +706,7 @@ smbios_type_4_init(uint32_t eax, ebx, ecx, edx;/* Specification says Type 4 table has length of 23h for v2.3+. */ -BUILD_BUG_ON (sizeof (*p) !=35 ); +BUILD_BUG_ON (sizeof (*p) !=0x23 );memset (p,0 ,sizeof (*p));
@@ -757,7 +757,7 @@ static void * smbios_type_7_init(void *start) {/* Specification says Type 7 table has length of 13h for v2.1+. */ -BUILD_BUG_ON (sizeof (struct smbios_type_7 ) !=19 ); +BUILD_BUG_ON (sizeof (struct smbios_type_7 ) !=0x13 );/* Only present when passed in. */ return smbios_pt_copy(start, 7, SMBIOS_HANDLE_TYPE7,
@@ -769,7 +769,7 @@ static void * smbios_type_8_init(void *start) {/* Specification says Type 8 table has length of 09h. */ -BUILD_BUG_ON (sizeof (struct smbios_type_8 ) !=9 ); +BUILD_BUG_ON (sizeof (struct smbios_type_8 ) !=0x09 );/* Only present when passed in. */ return smbios_pt_copy(start, 8, SMBIOS_HANDLE_TYPE8,
@@ -781,7 +781,7 @@ static void * smbios_type_9_init(void *start) {/* Specification says Type 9 table has length of 0Dh for v2.1-2.5. */ -BUILD_BUG_ON (sizeof (struct smbios_type_9 ) !=13 ); +BUILD_BUG_ON (sizeof (struct smbios_type_9 ) !=0x0d );/* Only present when passed in. */ return smbios_pt_copy(start, 9, SMBIOS_HANDLE_TYPE9,
@@ -799,7 +799,7 @@ smbios_type_11_init(void *start)int i;/* Specification says Type 11 table has length of 05h. */ -BUILD_BUG_ON (sizeof (*p) !=5 ); +BUILD_BUG_ON (sizeof (*p) !=0x05 ); next =smbios_pt_copy (start,11 ,SMBIOS_HANDLE_TYPE11 ,sizeof (*p));if ( next != start )
@@ -843,7 +843,7 @@ smbios_type_16_init(void *start, uint32_t memsize, int nr_mem_devs)struct smbios_type_16 *p = start;/* Specification says Type 16 table has length of 0Fh for v2.1-2.7. */ -BUILD_BUG_ON (sizeof (*p) !=15 ); +BUILD_BUG_ON (sizeof (*p) !=0x0f );memset (p,0 ,sizeof (*p));
@@ -871,7 +871,7 @@ smbios_type_17_init(void *start, uint32_t memory_size_mb, int instance)struct smbios_type_17 *p = start;/* Specification says Type 17 table has length of 1Bh for v2.3-2.6. */ -BUILD_BUG_ON (sizeof (*p) !=27 ); +BUILD_BUG_ON (sizeof (*p) !=0x1b );memset (p,0 ,sizeof (*p));
@@ -909,7 +909,7 @@ smbios_type_19_init(void *start, uint32_t memory_size_mb, int instance)struct smbios_type_19 *p = start;/* Specification says Type 19 table has length of 0Fh for v2.1-2.7. */ -BUILD_BUG_ON (sizeof (*p) !=15 ); +BUILD_BUG_ON (sizeof (*p) !=0x0f );memset (p,0 ,sizeof (*p));
@@ -934,7 +934,7 @@ smbios_type_20_init(void *start, uint32_t memory_size_mb, int instance)struct smbios_type_20 *p = start;/* Specification says Type 20 table has length of 13h for v2.1-2.7. */ -BUILD_BUG_ON (sizeof (*p) !=19 ); +BUILD_BUG_ON (sizeof (*p) !=0x13 );memset (p,0 ,sizeof (*p));
@@ -966,7 +966,7 @@ smbios_type_22_init(void *start)void *next;/* Specification says Type 22 table has length of 1Ah. */ -BUILD_BUG_ON (sizeof (*p) !=26 ); +BUILD_BUG_ON (sizeof (*p) !=0x1a ); next =smbios_pt_copy (start,22 ,SMBIOS_HANDLE_TYPE22 ,sizeof (*p));if ( next != start )
@@ -1030,7 +1030,7 @@ smbios_type_26_init(void *start)* Only present when passed in. */ - BUILD_BUG_ON(endof_field(struct smbios_type_26, oem_defined) != 20); + BUILD_BUG_ON(endof_field(struct smbios_type_26, oem_defined) != 0x14);return smbios_pt_copy (start,26 ,SMBIOS_HANDLE_TYPE26 , endof_field(struct smbios_type_26, oem_defined));
@@ -1047,7 +1047,7 @@ smbios_type_27_init(void *start)* Only present when passed in. */ - BUILD_BUG_ON(endof_field(struct smbios_type_27, oem_defined) != 12); + BUILD_BUG_ON(endof_field(struct smbios_type_27, oem_defined) != 0x0c);return smbios_pt_copy (start,27 ,SMBIOS_HANDLE_TYPE27 , endof_field(struct smbios_type_27, oem_defined));
@@ -1064,7 +1064,7 @@ smbios_type_28_init(void *start)* Only present when passed in. */ - BUILD_BUG_ON(endof_field(struct smbios_type_28, oem_defined) != 20); + BUILD_BUG_ON(endof_field(struct smbios_type_28, oem_defined) != 0x14);return smbios_pt_copy (start,28 ,SMBIOS_HANDLE_TYPE28 , endof_field(struct smbios_type_28, oem_defined));
@@ -1077,7 +1077,7 @@ smbios_type_32_init(void *start)struct smbios_type_32 *p = start;/* Specification says Type 32 table has length of at least 0Bh. */ -BUILD_BUG_ON (sizeof (*p) !=11 ); +BUILD_BUG_ON (sizeof (*p) !=0x0b );memset (p,0 ,sizeof (*p));
@@ -1103,7 +1103,7 @@ smbios_type_39_init(void *start)* Only present when passed in. */ - BUILD_BUG_ON(endof_field(struct smbios_type_39, characteristics) != 16); + BUILD_BUG_ON(endof_field(struct smbios_type_39, characteristics) != 0x10);return smbios_pt_copy (start,39 ,SMBIOS_HANDLE_TYPE39 , endof_field(struct smbios_type_39, characteristics));
Signature · 1 line
2.34.1
Quoted 8 lines · Petr Beneš
From: Petr Beneš <[email protected]>
Match the number format the specification gives.
No functional change.
Signed-off-by Petr Beneš <[email protected]>Suggested-By <[email protected]>
Please have tags ordered chronologically, and please also add a proper name. (Also, nit: -by, not -By.)
tools/firmware/hvmloader/smbios.c smbios_type_3_init(void *start) · line 650
Quoted 8 lines
tools/firmware/hvmloader/smbios.c +1
-1@@ -647,7 +647,7 @@ smbios_type_3_init(void *start)* which corresponds with the end of the "Security Status" field. */ - BUILD_BUG_ON(endof_field(struct smbios_type_3, security_status) != 13); + BUILD_BUG_ON(endof_field(struct smbios_type_3, security_status) != 0x0d);
As already indicated when these changes were being done within a bigger patch, I don't see a real need for this. It's extra churn for almost no gain. If someone else wants to ack this, I'm not going to stand in the way, but I won't approve it.
Pretty certainly there's no justification at all for this to still go into 4.21.
Jan