diff mbox series

fsp: Fix possible use of null "%s" prlog argument

Message ID 20220524154954.97241-1-arbab@linux.ibm.com
State Accepted
Headers show
Series fsp: Fix possible use of null "%s" prlog argument | expand

Checks

Context Check Description
snowpatch_ozlabs/github-Docker_builds_and_checks fail check_build (ubuntu-rolling) failed at step Create Docker image.

Commit Message

Reza Arbab May 24, 2022, 3:49 p.m. UTC
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.

Signed-off-by: Reza Arbab <arbab@linux.ibm.com>
---
 hw/fsp/fsp-codeupdate.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Dan Horák May 24, 2022, 4:10 p.m. UTC | #1
On Tue, 24 May 2022 10:49:54 -0500
Reza Arbab <arbab@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@danny.cz>


		Dan

 
> Signed-off-by: Reza Arbab <arbab@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@lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/skiboot
Reza Arbab June 13, 2022, 8:40 p.m. UTC | #2
On Tue, May 24, 2022 at 10:49:54AM -0500, Reza Arbab 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.

Applied to master.
diff mbox series

Patch

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");
 }