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

Michael Brown mcb30 at ipxe.org
Fri Jan 25 17:26:54 UTC 2019

On 25/01/2019 16:53, Bruce Rogers wrote:
> 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.

I'd prefer not to have to work around that on an instance-by-instance 
basis; we explicitly allow NULL as a value for a %s format specifier, 
and there are multiple other code paths that will do this.

Is there a way to inform GCC 9 that NULL is allowed as a %s value?

If not, then does marking efi_handle_name() as noinline fix the warning?



More information about the ipxe-devel mailing list