Identified by clang-tidy: vsockserver.c:105:17: warning: 3rd function call argument is an uninitialized value [clang-analyzer-core.CallAndMessage] while ((opt = argz_next(binder_opts, binder_opts_len, opt))) ^ vsockserver.c:44:3: note: Assuming the condition is false argz_add(&binder_opts, &binder_opts_len, BINDIR "/vsockserver-socketbinder") || ^ vsockserver.c:44:3: note: Left side of '||' is false vsockserver.c:47:9: note: Assuming the condition is false while ((opt = getopt(argc, argv, "+1qQv")) != -1) { ^ vsockserver.c:47:2: note: Loop condition is false. Execution continues on line 68 while ((opt = getopt(argc, argv, "+1qQv")) != -1) { ^ vsockserver.c:68:6: note: Assuming 'alloc_failed' is false if (alloc_failed) ^ vsockserver.c:68:2: note: Taking false branch if (alloc_failed) ^ vsockserver.c:77:6: note: Assuming the condition is false if (optind > argc - 3) ^ vsockserver.c:77:2: note: Taking false branch if (optind > argc - 3) ^ vsockserver.c:81:6: note: Assuming the condition is false if (argz_add(&binder_opts, &binder_opts_len, "--") || ^ vsockserver.c:81:6: note: Left side of '||' is false vsockserver.c:82:6: note: Assuming the condition is false argz_add(&binder_opts, &binder_opts_len, argv[optind++]) || ^ vsockserver.c:81:6: note: Left side of '||' is false if (argz_add(&binder_opts, &binder_opts_len, "--") || ^ vsockserver.c:83:6: note: Assuming the condition is false argz_add(&binder_opts, &binder_opts_len, argv[optind++])) ^ vsockserver.c:81:2: note: Taking false branch if (argz_add(&binder_opts, &binder_opts_len, "--") || ^ vsockserver.c:89:6: note: Assuming the condition is false if (argz_append(&binder_opts, &binder_opts_len, daemon_opts, daemon_opts_len)) ^ vsockserver.c:89:2: note: Taking false branch if (argz_append(&binder_opts, &binder_opts_len, daemon_opts, daemon_opts_len)) ^ vsockserver.c:96:23: note: Assuming 'i' is >= 'argc' for (int i = optind; i < argc; i++) ^ vsockserver.c:96:2: note: Loop condition is false. Execution continues on line 100 for (int i = optind; i < argc; i++) ^ vsockserver.c:100:6: note: Assuming 'verbosity' is equal to all if (verbosity == all) { ^ vsockserver.c:100:2: note: Taking true branch if (verbosity == all) { ^ vsockserver.c:101:3: note: 'opt' declared without an initial value char *opt; ^ vsockserver.c:105:17: note: 3rd function call argument is an uninitialized value while ((opt = argz_next(binder_opts, binder_opts_len, opt))) --- vsockserver.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vsockserver.c b/vsockserver.c index f740a8a..b717eee 100644 --- a/vsockserver.c +++ b/vsockserver.c @@ -98,7 +98,7 @@ int main(int argc, char *argv[]) diee(EX_OSERR, "malloc"); if (verbosity == all) { - char *opt; + char *opt = 0; // Log the full argv before we exec it. fprintf(stderr, "%s: executing", program_invocation_short_name); -- 2.30.0