Skip to contentSkip to conversation

cmd: efidebug: fix a build error in show_efi_boot_opt()

PATCH New AKASHI Takahiro 2 participants 2 messages Nov 26, 2019

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 cmd: efidebug: fix a build error in show_efi_boot_opt()

I detected the following error in sandbox with Clang on Travis CI:
+cmd/efidebug.c:703:15: error: result of comparison of constant
9223372036854775822 with expression of type 'int' is always false [-Werror,-Wtautological-constant-out-of-range-compare]
+ else if (ret == EFI_NOT_FOUND)
+ ~~~ ^ ~~~~~~~~~~~~~

Simply changing a type of 'ret' to efi_status_t will fix this error.

---
 cmd/efidebug.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
cmd/efidebug.c +2 -2
index ef97e19d0735..1fff4390deae 100644
@@ -684,7 +684,7 @@ static void show_efi_boot_opt(int id)
 	efi_guid_t guid;
 	void *data = NULL;
 	efi_uintn_t size;
-	int ret;
+	efi_status_t ret;
 
 	sprintf(var_name, "Boot%04X", id);
 	p = var_name16;
@@ -693,7 +693,7 @@ static void show_efi_boot_opt(int id)
 
 	size = 0;
 	ret = EFI_CALL(RT->get_variable(var_name16, &guid, NULL, &size, NULL));
-	if (ret == (int)EFI_BUFFER_TOO_SMALL) {
+	if (ret == EFI_BUFFER_TOO_SMALL) {
 		data = malloc(size);
 		ret = EFI_CALL(RT->get_variable(var_name16, &guid, NULL, &size,
 						data));
Signature · 1 line
2.24.0
#1 lore raw

PATCH v2 1/1 cmd: efidebug: fix a build error in show_efi_boot_opt()

Quoted 10 lines · AKASHI Takahiro

I detected the following error in sandbox with Clang on Travis CI:
+cmd/efidebug.c:703:15: error: result of comparison of constant
9223372036854775822 with expression of type 'int' is always false [-Werror,-Wtautological-constant-out-of-range-compare]
+ else if (ret == EFI_NOT_FOUND)
+ ~~~ ^ ~~~~~~~~~~~~~

Simply changing a type of 'ret' to efi_status_t will fix this error.

Quoted 27 lines
---
  cmd/efidebug.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
cmd/efidebug.c +2 -2
index ef97e19d0735..1fff4390deae 100644
@@ -684,7 +684,7 @@ static void show_efi_boot_opt(int id)
  	efi_guid_t guid;
  	void *data = NULL;
  	efi_uintn_t size;
-	int ret;
+	efi_status_t ret;
 
  	sprintf(var_name, "Boot%04X", id);
  	p = var_name16;
@@ -693,7 +693,7 @@ static void show_efi_boot_opt(int id)
 
  	size = 0;
  	ret = EFI_CALL(RT->get_variable(var_name16, &guid, NULL, &size, NULL));
-	if (ret == (int)EFI_BUFFER_TOO_SMALL) {
+	if (ret == EFI_BUFFER_TOO_SMALL) {
  		data = malloc(size);
  		ret = EFI_CALL(RT->get_variable(var_name16, &guid, NULL, &size,
  						data));