From 9941337c5f7cfa2f5c0d19c53f0bb9a2444f43ce Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Mon, 4 May 2020 19:00:30 +0200 Subject: pkg/csource: init res var in generated call MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It seems that gcc in ubuntu on travis got dumber: : In function ‘execute_call’: :1741:6: error: ‘res’ may be used uninitialized in this function [-Werror=maybe-uninitialized] cc1: all warnings being treated as errors compiler invocation: arm-linux-gnueabi-gcc [-o /tmp/syz-executor675297211 -DGOOS_linux=1 -DGOARCH_arm=1 -DHOSTGOOS_linux=1 -x c - -O2 -pthread -Wall -Werror -Wparentheses -Wframe-larger-than=16384 -D__LINUX_ARM_ARCH__=6 -march=armv6 -static -Wno-overflow] https://travis-ci.com/github/dvyukov/syzkaller/jobs/327487382 Though, we generate the same code and res seems to be initialized on all paths. Initialize it explicitly. --- pkg/csource/csource.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'pkg/csource/csource.go') diff --git a/pkg/csource/csource.go b/pkg/csource/csource.go index 84f458472..d2ab513cc 100644 --- a/pkg/csource/csource.go +++ b/pkg/csource/csource.go @@ -116,7 +116,7 @@ func (ctx *context) generateSyscalls(calls []string, hasVars bool) string { } } else { if hasVars || opts.Trace { - fmt.Fprintf(buf, "\tintptr_t res;") + fmt.Fprintf(buf, "\tintptr_t res = 0;\n") } fmt.Fprintf(buf, "\tswitch (call) {\n") for i, c := range calls { -- cgit mrf-deployment