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

Reza Arbab arbab at linux.ibm.com
Wed May 25 01:49:54 AEST 2022


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 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



More information about the Skiboot mailing list