[Replicant] [libsamsung-ipc][PATCH 08/10] tools: nv_data-imei: main: Fix uninitialized command and command_option structs

Denis 'GNUtoo' Carikli GNUtoo at cyberdimension.org
Sat Feb 13 13:17:47 UTC 2021


This was spotted by compiling nv_data-imei on Replicant 6: it gave
the following warning:
    hardware/replicant/libsamsung-ipc/tools/nv_data-imei.c:1062:15:
    warning: 'command' may be used uninitialized in this function
    [-Wmaybe-uninitialized]
       rc = command->func(nv_data_path, &offset);
                   ^

Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo at cyberdimension.org>
---
 tools/nv_data-imei.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/nv_data-imei.c b/tools/nv_data-imei.c
index 3ed335f..766c7a8 100644
--- a/tools/nv_data-imei.c
+++ b/tools/nv_data-imei.c
@@ -843,8 +843,8 @@ int main(int argc, char * const argv[])
 	opterr = 0;
 	struct imei imei;
 	struct offset offset;
-	struct command *command;
-	struct command_option *option;
+	struct command *command = NULL;
+	struct command_option *option = NULL;
 	char *nv_data_path;
 	int c, rc;
 
-- 
2.30.1



More information about the Replicant mailing list