[PATCH 1/1] efi_loader: fix efi_ecpt_register()

Heinrich Schuchardt heinrich.schuchardt at canonical.com
Fri Feb 10 09:26:45 CET 2023


num_entries should be unsigned to avoid warnings. As the target field is
u16 we should use this type.

    lib/efi_loader/efi_conformance.c: In function ‘efi_ecpt_register’:
    lib/efi_loader/efi_conformance.c:30:33: warning:
    conversion to ‘long unsigned int’ from ‘int’ may change
    the sign of the result [-Wsign-conversion]
       30 |         ecpt_size = num_entries * sizeof(efi_guid_t)
          |                                 ^
    lib/efi_loader/efi_conformance.c:46:36: warning:
    conversion from ‘int’ to ‘u16’ {aka ‘short unsigned int’}
    may change value [-Wconversion]
       46 |         ecpt->number_of_profiles = num_entries;
          |                                    ^~~~~~~~~~~

Fixes: 6b92c1735205 ("efi: Create ECPT table")
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt at canonical.com>
---
 lib/efi_loader/efi_conformance.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/efi_loader/efi_conformance.c b/lib/efi_loader/efi_conformance.c
index 3036d46349..0ca26f57a7 100644
--- a/lib/efi_loader/efi_conformance.c
+++ b/lib/efi_loader/efi_conformance.c
@@ -22,7 +22,7 @@ static const efi_guid_t efi_ebbr_2_1_guid =
  */
 efi_status_t efi_ecpt_register(void)
 {
-	int num_entries = 0;
+	u16 num_entries = 0;
 	struct efi_conformance_profiles_table *ecpt;
 	efi_status_t ret;
 	size_t ecpt_size;
-- 
2.38.1



More information about the U-Boot mailing list