]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
coverity: most of the remaining unsigned >= 0 comparison warnings
authorPaul Floyd <pjfloyd@wanadoo.fr>
Sun, 1 Oct 2023 18:51:59 +0000 (20:51 +0200)
committerPaul Floyd <pjfloyd@wanadoo.fr>
Sun, 1 Oct 2023 18:51:59 +0000 (20:51 +0200)
13 files changed:
VEX/priv/guest_arm_toIR.c
VEX/priv/guest_mips_toIR.c
VEX/priv/host_amd64_isel.c
VEX/priv/host_arm64_isel.c
VEX/priv/host_arm_isel.c
VEX/priv/host_ppc_isel.c
coregrind/m_debuginfo/image.c
coregrind/m_debuginfo/readelf.c
coregrind/m_syswrap/syswrap-amd64-darwin.c
coregrind/m_transtab.c
helgrind/hg_wordset.c
helgrind/libhb_core.c
mpi/libmpiwrap.c

index 5e9e49568c2768fe74e2753f939f8b4db79ab347..58d4ed6b1e5a19065944d6a0500541dc47bd0345 100644 (file)
@@ -209,7 +209,7 @@ static inline UShort getUShortLittleEndianly ( const UChar* p )
 }
 
 static UInt ROR32 ( UInt x, UInt sh ) {
-   vassert(sh >= 0 && sh < 32);
+   vassert(sh < 32);
    if (sh == 0)
       return x;
    else
index 317b49cf790d23a44e699fb008dbfbe9e439a9d3..1285edad0b83b0f0a6b21fc63d2235d50f94d204 100644 (file)
@@ -19248,7 +19248,7 @@ static UInt disInstr_MIPS_WRK_Special3(UInt cins, const VexArchInfo* archinfo,
          size = msb + 1;
          DIP("dext r%u, r%u, %u, %u", rt, rs, lsb, msb + 1);
          t1 = newTemp(Ity_I64);
-         vassert(lsb >= 0 && lsb < 32);
+         vassert(lsb < 32);
          vassert(size > 0 && size <= 32);
          vassert((lsb + size) > 0 && (lsb + size) <= 63);
 
index 762351961715c25e42be0524f9dc9158a9bdf366..e15e1e60fb85d508c952bf536f7e1b2f367fac19 100644 (file)
@@ -165,7 +165,6 @@ typedef
 
 static HReg lookupIRTemp ( ISelEnv* env, IRTemp tmp )
 {
-   vassert(tmp >= 0);
    vassert(tmp < env->n_vregmap);
    return env->vregmap[tmp];
 }
index 82cb2d78c6aba0cd5d524758bfd5e7480d1cc91a..4b75a0867296916b33f96cf4fcab405f5b23feab 100644 (file)
@@ -112,7 +112,6 @@ typedef
 
 static HReg lookupIRTemp ( ISelEnv* env, IRTemp tmp )
 {
-   vassert(tmp >= 0);
    vassert(tmp < env->n_vregmap);
    return env->vregmap[tmp];
 }
index 891c9f68c244848099f92e5986cc1825dcb445cc..8b3264843891f8fcd35a014dccffa8db688a67de 100644 (file)
@@ -126,14 +126,12 @@ typedef
 
 static HReg lookupIRTemp ( ISelEnv* env, IRTemp tmp )
 {
-   vassert(tmp >= 0);
    vassert(tmp < env->n_vregmap);
    return env->vregmap[tmp];
 }
 
 static void lookupIRTemp64 ( HReg* vrHI, HReg* vrLO, ISelEnv* env, IRTemp tmp )
 {
-   vassert(tmp >= 0);
    vassert(tmp < env->n_vregmap);
    vassert(! hregIsInvalid(env->vregmapHI[tmp]));
    *vrLO = env->vregmap[tmp];
index 34b6afe7cfcf4485a8663b53df3f4fce9deb3f3a..ff87ae7ed66e9592dc31133c028059e5218f9129 100644 (file)
@@ -300,7 +300,6 @@ typedef
  
 static HReg lookupIRTemp ( ISelEnv* env, IRTemp tmp )
 {
-   vassert(tmp >= 0);
    vassert(tmp < env->n_vregmap);
    return env->vregmapLo[tmp];
 }
index 70c3bd859a5b0fc07fa3d1cb24df04bffacabaec..ede83573093d3da3bdd1d1a218f848682900b26b 100644 (file)
@@ -142,7 +142,6 @@ static Bool is_sane_CEnt ( const HChar* who, const DiImage* img, UInt i )
       if (!(ce->used == ce->size || ce->used == 0)) goto fail;
    } else {
       if (!(ce->size == CACHE_ENTRY_SIZE)) goto fail;
-      if (!(ce->off >= 0)) goto fail;
       if (!(ce->off + ce->used <= img->real_size)) goto fail;
    }
    return True;
index 5456fafb02e9eaa7e23ef3bf1a8e8215655990f3..9bb60f42ad558a9cad12cafde30958bb8fe59d4c 100644 (file)
@@ -1098,7 +1098,7 @@ void read_elf_symtab__ppc64be_linux(
       disym.isText    = elem->is_text;
       disym.isIFunc   = elem->is_ifunc;
       disym.isGlobal  = elem->is_global;
-      if (cstr) { ML_(dinfo_free)(cstr); cstr = NULL; }
+      ML_(dinfo_free)(cstr);
       vg_assert(disym.pri_name != NULL);
 
       ML_(addSym) ( di, &disym );
index 1b22a96d47b46991c261ecc39a466b351c8b399b..5b70e8377cb17cf1a95f74674d17a05c8d76d24c 100644 (file)
@@ -574,7 +574,7 @@ void wqthread_hijack(Addr self, Addr kport, Addr stackaddr, Addr workitem,
 
       // Go!
       /* Same comments as the 'release' in the then-clause.
-         start_thread_NORETURN calls run_thread_NORETURN calls
+         start_thread_NORETURN calls run_a_thread_NORETURN calls
          thread_wrapper which acquires the lock before continuing.
          Let's hope nothing non-thread-local happens until that point.
 
index 789a169dcd73beb344308b3e793bdcfd4a514fa4..724ea6b1fc4fc48914493dc8fbd5f868368f5c23 100644 (file)
@@ -1152,7 +1152,7 @@ UInt addEClassNo ( /*MOD*/Sector* sec, EClassNo ec, TTEno tteno )
    Int    old_sz, new_sz, i, r;
    TTEno  *old_ar, *new_ar;
 
-   vg_assert(ec >= 0 && ec < ECLASS_N);
+   vg_assert(ec < ECLASS_N);
    vg_assert(tteno < N_TTES_PER_SECTOR);
 
    if (DEBUG_TRANSTAB) VG_(printf)("ec %d  gets %d\n", ec, (Int)tteno);
index 3b780262a65fac9ddeb916cc9240a0d4a38b2623..1f9e30ddcc9e34a78e74dc3612fec87338d62348 100644 (file)
@@ -489,7 +489,7 @@ void HG_(dieWS) ( WordSetU* wsu, WordSet ws )
 Bool HG_(plausibleWS) ( WordSetU* wsu, WordSet ws )
 {
    if (wsu == NULL) return False;
-   if (ws < 0 || ws >= wsu->ix2vec_used)
+   if (ws >= wsu->ix2vec_used)
       return False;
    return True;
 }
index 101624028f02ed8db2af18df5f884e55614bb286..cb3daaa1399b7aa3ab0eec8d43ee47b657c18385 100644 (file)
@@ -5941,7 +5941,6 @@ static
 void zsm_swrite64 ( Addr a, SVal svNew ) {
    CacheLine* cl; 
    UWord      cloff, tno;
-   SizeT      i;
    //UWord    toff;
    stats__cline_swrite64s++;
    if (UNLIKELY(!aligned64(a))) goto slowcase;
index b277617854006ae094ec6f46d1d0eebd4249ab32..df0a1ae9df065a0ab0b7b5c32c1ac122ca1ef148 100644 (file)
@@ -2279,10 +2279,10 @@ long WRAPPER_FOR(PMPI_Init)(int *argc, char ***argv)
    VALGRIND_GET_ORIG_FN(fn);
    before("Init");
    if (argc) {
-      check_mem_is_defined_untyped(argc, sizeof(int));
+      check_mem_is_defined_untyped(argc, sizeof(*argc));
    }
    if (argc && argv) {
-      check_mem_is_defined_untyped(*argv, *argc * sizeof(char**));
+      check_mem_is_defined_untyped(*argv, *argc * sizeof(**argv));
    }
    if (cONFIG_DER) VALGRIND_DISABLE_ERROR_REPORTING;
    CALL_FN_W_WW(err, fn, argc,argv);