/* If this isn't true, we're in Big Trouble. */
vassert(8 == sizeof(VexGuestX86SegDescr));
- if (verboze)
+ if (verboze) {
+ // Coverity is right but this is unimportant
+ // coverity[DEADCODE:FALSE]
vex_printf("x86h_use_seg_selector: "
"seg_selector = 0x%x, vaddr = 0x%x\n",
seg_selector, virtual_addr);
+ }
/* Check for wildly invalid selector. */
if (seg_selector & ~0xFFFF)
for (j = 0; j < tteC->n_tte2ec; j++) {
ec_num = tteC->tte2ec_ec[j];
- if (ec_num < 0 || ec_num >= ECLASS_N)
+ if (ec_num >= ECLASS_N)
BAD("tteC->tte2ec_ec[..] out of range");
ec_idx = tteC->tte2ec_ix[j];
if (ec_idx < 0 || ec_idx >= sec->ec2tte_used[ec_num])
static char *vgdb_prefix = NULL;
static char *valgrind_path = NULL;
static char **vargs;
-static char cvargs = 0;
+static int cvargs = 0;
char *timestamp_str (Bool produce)
{
// argc - i is the number of left over arguments
// allocate enough space, put all args in it.
cvargs = argc - i - 1;
- vargs = vmalloc (cvargs * sizeof(vargs));
+ vargs = vmalloc (cvargs * sizeof(*vargs));
i++;
for (int j = 0; i < argc; i++) {
vargs[j] = argv[i];
kind &= PTHREAD_MUTEX_RECURSIVE | PTHREAD_MUTEX_ERRORCHECK |
PTHREAD_MUTEX_NORMAL | PTHREAD_MUTEX_DEFAULT;
- if (kind == PTHREAD_MUTEX_RECURSIVE)
+ if (kind == PTHREAD_MUTEX_RECURSIVE) {
return mutex_type_recursive_mutex;
- else if (kind == PTHREAD_MUTEX_ERRORCHECK)
+ }
+ if (kind == PTHREAD_MUTEX_ERRORCHECK) {
return mutex_type_errorcheck_mutex;
- else if (kind == PTHREAD_MUTEX_NORMAL)
+ }
+ if (kind == PTHREAD_MUTEX_NORMAL) {
return mutex_type_default_mutex;
- else if (kind == PTHREAD_MUTEX_DEFAULT)
- // @todo PJF what about Solaris?
-#if defined(VGO_freebsd)
- return mutex_type_errorcheck_mutex;
-#else
+ }
+ if (kind == PTHREAD_MUTEX_DEFAULT) {
+ // On FreeBSD PTHREAD_MUTEX_DEFAULT is the same as PTHREAD_MUTEX_ERRORCHECK
+ // so this code is unreachable, but that's not true for all platforms
+ // so just ignore the warning
+ // coverity[DEADCODE:FALSE]
return mutex_type_default_mutex;
-#endif
+ }
#if defined(HAVE_PTHREAD_MUTEX_ADAPTIVE_NP)
- else if (kind == PTHREAD_MUTEX_ADAPTIVE_NP)
+ if (kind == PTHREAD_MUTEX_ADAPTIVE_NP) {
return mutex_type_default_mutex;
+ }
#endif
- else
- return mutex_type_invalid_mutex;
+ return mutex_type_invalid_mutex;
}
#if defined(VGO_solaris)
WordVec* wv;
UWord i;
if (wsu == NULL) return False;
- if (ws < 0 || ws >= wsu->ix2vec_used)
+ if (ws >= wsu->ix2vec_used)
return False;
wv = do_ix2vec( wsu, ws );
/* can never happen .. do_ix2vec will assert instead. Oh well. */