[ipxe-devel] [PATCH] [efi] Simplify diagnostic for NULL handle

Bruce Rogers brogers at suse.com
Fri Jan 25 16:53:19 UTC 2019


Compiling with GCC 9 now warns as follows:
interface/efi/efi_debug.c:334:3: error: ‘%s’ directive argument is null [-Werror=format-overflow=]
  334 |   printf ( "HANDLE %s could not retrieve protocols\n",
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  335 |     efi_handle_name ( handle ) );
      |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors

Simplify this diagnostic by simply indicating a <NULL> has been
passed as a handle.

Signed-off-by: Bruce Rogers <brogers at suse.com>
---
 src/interface/efi/efi_debug.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/interface/efi/efi_debug.c b/src/interface/efi/efi_debug.c
index 8ea0a822..19fba767 100644
--- a/src/interface/efi/efi_debug.c
+++ b/src/interface/efi/efi_debug.c
@@ -331,8 +331,7 @@ void dbg_efi_protocols ( EFI_HANDLE handle ) {
 
 	/* Sanity check */
 	if ( ! handle ) {
-		printf ( "HANDLE %s could not retrieve protocols\n",
-			 efi_handle_name ( handle ) );
+		printf ( "HANDLE <NULL> could not retrieve protocols\n" );
 		return;
 	}
 
-- 
2.20.1




More information about the ipxe-devel mailing list