[PATCH 32/32] net: fastboot: keep error message initialized at all times

Ahmad Fatoum a.fatoum at pengutronix.de
Mon Sep 5 02:55:57 PDT 2022


Static analyzer points out that an unfortunate sequence of fastboot
commands can have us end up with an uninitialized error_msg, so
initialize it in that case, so we have something in there at all times.

Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
---
 net/fastboot.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/net/fastboot.c b/net/fastboot.c
index aa483f57a74e..932eb05c4341 100644
--- a/net/fastboot.c
+++ b/net/fastboot.c
@@ -126,6 +126,8 @@ static void fastboot_send(struct fastboot_net *fbn,
 
 	if (error_msg)
 		header.id = FASTBOOT_ERROR;
+	else
+		error_msg = "no error";
 
 	/* send header */
 	memcpy(packet, &header, sizeof(header));
-- 
2.30.2




More information about the barebox mailing list