[Skiboot] [PATCH] fsp: Fix possible use of null "%s" prlog argument

Dan Horák dan at danny.cz
Wed May 25 02:10:08 AEST 2022


On Tue, 24 May 2022 10:49:54 -0500
Reza Arbab <arbab at linux.ibm.com> wrote:

> Caught by CI in fedora-rawhide (GCC 12):
> 
>   hw/fsp/fsp-codeupdate.c:116:26: error: '%s' directive argument is null [-Werror=format-overflow=]
>     116 |         prlog(PR_NOTICE, "CUPD: IPL SIDE = %s\n", side);
> 
> To prevent this, explicitly print the value of ipl_side instead.

LGTM

Reviewed-by: Dan Horák <dan at danny.cz>


		Dan

 
> Signed-off-by: Reza Arbab <arbab at linux.ibm.com>
> ---
>  hw/fsp/fsp-codeupdate.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/hw/fsp/fsp-codeupdate.c b/hw/fsp/fsp-codeupdate.c
> index 3cd5b2bc9bc5..112054517913 100644
> --- a/hw/fsp/fsp-codeupdate.c
> +++ b/hw/fsp/fsp-codeupdate.c
> @@ -113,12 +113,14 @@ static void get_ipl_side(void)
>  	iplp = dt_find_by_path(dt_root, "ipl-params/ipl-params");
>  	if (iplp)
>  		side = dt_prop_get_def(iplp, "cec-ipl-side", NULL);
> -	prlog(PR_NOTICE, "CUPD: IPL SIDE = %s\n", side);
>  
>  	if (!side || !strcmp(side, "temp"))
>  		ipl_side = FW_IPL_SIDE_TEMP;
>  	else
>  		ipl_side = FW_IPL_SIDE_PERM;
> +
> +	prlog(PR_NOTICE, "CUPD: IPL SIDE = %s\n",
> +	      ipl_side == FW_IPL_SIDE_TEMP ? "temp" : "perm");
>  }
>  
>  
> -- 
> 2.31.1
> 
> _______________________________________________
> Skiboot mailing list
> Skiboot at lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/skiboot


More information about the Skiboot mailing list