From: Paul Floyd Date: Sat, 2 Sep 2023 21:19:17 +0000 (+0200) Subject: coverity: a few bits of dead code and one vgdb command line leak X-Git-Tag: VALGRIND_3_22_0~91 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9ed8f42357f73c290c7bff85246977ff1972fbb8;p=thirdparty%2Fvalgrind.git coverity: a few bits of dead code and one vgdb command line leak --- diff --git a/coregrind/launcher-freebsd.c b/coregrind/launcher-freebsd.c index 030b183b57..8687de3f59 100644 --- a/coregrind/launcher-freebsd.c +++ b/coregrind/launcher-freebsd.c @@ -198,7 +198,7 @@ int main(int argc, char** argv, char** envp) const char *toolname = NULL; const char *clientname = NULL; const char *platform; - const char *default_platform; + const char *default_platform = VG_PLATFORM; const char *cp; char *toolfile; char launcher_name[PATH_MAX+1]; @@ -243,23 +243,6 @@ int main(int argc, char** argv, char** envp) toolname = "memcheck"; } - /* Select a platform to use if we can't decide that by looking at - the executable (eg because it's a shell script). Note that the - default_platform is not necessarily either the primary or - secondary build target. Instead it's chosen to maximise the - chances that /bin/sh will work on it. Hence for a primary - target of ppc64-linux we still choose ppc32-linux as the default - target, because on most ppc64-linux setups, the basic /bin, - /usr/bin, etc, stuff is built in 32-bit mode, not 64-bit - mode. */ - if (0==strcmp(VG_PLATFORM,"x86-freebsd")) { - default_platform = "x86-freebsd"; - } else if (0==strcmp(VG_PLATFORM,"amd64-freebsd")) { - default_platform = "amd64-freebsd"; - } else { - barf("Unknown VG_PLATFORM '%s'", VG_PLATFORM); - } - /* Work out what platform to use, or use the default platform if not possible. */ if (clientname == NULL) { diff --git a/coregrind/vgdb.c b/coregrind/vgdb.c index c024ffca6b..9e21a00d66 100644 --- a/coregrind/vgdb.c +++ b/coregrind/vgdb.c @@ -2269,6 +2269,11 @@ void parse_options(int argc, char** argv, arg_errors++; } } else if (is_opt(argv[i], "--vgdb-prefix=")) { + if (vgdb_prefix) { + // was specified more than once on the command line + // ignore earlier uses + free(vgdb_prefix); + } vgdb_prefix = strdup (argv[i] + 14); } else if (is_opt(argv[i], "--valgrind=")) { char *path = argv[i] + 11; diff --git a/include/pub_tool_basics.h b/include/pub_tool_basics.h index d22a425238..bf5a5ba7fa 100644 --- a/include/pub_tool_basics.h +++ b/include/pub_tool_basics.h @@ -233,11 +233,6 @@ typedef UWord _val; UWord _val2; Bool _isError; -#if defined(VGP_amd64_freebsd) - char padding[7]; -#else - char padding[3]; -#endif } SysRes; diff --git a/memcheck/mc_translate.c b/memcheck/mc_translate.c index 72ccb3c8c6..f8aca1641c 100644 --- a/memcheck/mc_translate.c +++ b/memcheck/mc_translate.c @@ -4822,18 +4822,11 @@ IRAtom* expr2vbits_Binop ( MCEnv* mce, and_or_ty = Ity_I1; improve = mkImproveOR1; goto do_And_Or; do_And_Or: - return - assignNew( - 'V', mce, - and_or_ty, - difd(mce, uifu(mce, vatom1, vatom2), - difd(mce, improve(mce, atom1, vatom1), - improve(mce, atom2, vatom2) ) ) ); - return assignNew('V', mce, and_or_ty, difd(mce, uifu(mce, vatom1, vatom2), difd(mce, improve(mce, atom1, vatom1), improve(mce, atom2, vatom2) ) ) ); + case Iop_Xor8: return mkUifU8(mce, vatom1, vatom2); case Iop_Xor16: