]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
coverity: unsigned comparisons with 0
authorPaul Floyd <pjfloyd@wanadoo.fr>
Wed, 22 Nov 2023 20:22:18 +0000 (21:22 +0100)
committerPaul Floyd <pjfloyd@wanadoo.fr>
Wed, 22 Nov 2023 20:22:18 +0000 (21:22 +0100)
VEX/priv/guest_s390_helpers.c
VEX/priv/ir_defs.c
coregrind/m_mallocfree.c
coregrind/m_syswrap/syswrap-generic.c
coregrind/m_transtab.c
helgrind/hg_wordset.c

index 693e96bf6f9afda7315a450a5936dd08c1f04122..008f8c6c8c2189154dbecf2730a893a9426138a0 100644 (file)
@@ -570,7 +570,7 @@ s390_do_cu24(UInt srcval, UInt low_surrogate)
 
    srcval &= 0xffff;
 
-   if ((srcval >= 0x0000 && srcval <= 0xd7ff) ||
+   if ((srcval <= 0xd7ff) ||
        (srcval >= 0xdc00 && srcval <= 0xffff)) {
       retval = srcval;
    } else {
index 31710eb33a65e80c0793415c72de068b2383da06..0ef49eaa6adfbe1337675ac59a3f16746848933c 100644 (file)
@@ -4552,7 +4552,7 @@ static
 void useBeforeDef_Temp ( const IRSB* bb, const IRStmt* stmt, IRTemp tmp,
                          Int* def_counts )
 {
-   if (tmp < 0 || tmp >= bb->tyenv->types_used)
+   if (tmp >= bb->tyenv->types_used)
       sanityCheckFail(bb,stmt, "out of range Temp in IRExpr");
    if (def_counts[tmp] < 1)
       sanityCheckFail(bb,stmt, "IRTemp use before def in IRExpr");
@@ -4564,7 +4564,7 @@ void assignedOnce_Temp(const IRSB *bb, const IRStmt *stmt, IRTemp tmp,
                        const HChar *err_msg_out_of_range,
                        const HChar *err_msg_assigned_more_than_once)
 {
-   if (tmp < 0 || tmp >= n_def_counts) {
+   if (tmp >= n_def_counts) {
       sanityCheckFail(bb, stmt, err_msg_out_of_range);
    }
 
index 96104c8d57c170ff00d7507fbf086c3a235cdadd..dbbcb93961ff7717aa6b2b2a7797376a56e68591 100644 (file)
@@ -1001,7 +1001,7 @@ Superblock* maybe_findSb ( Arena* a, Addr ad )
    while (min <= max) {
       Superblock * sb; 
       SizeT pos = min + (max - min)/2;
-      if (pos < 0 || pos >= a->sblocks_used)
+      if (pos >= a->sblocks_used)
          return NULL;
       sb = a->sblocks[pos];
       if ((Addr)&sb->payload_bytes[0] <= ad
index d2ff8c0f440c99f03a514228f58f0e2218d9b47b..8550ef942c875d20564f2eb01981651b0377fa65 100644 (file)
@@ -4351,8 +4351,7 @@ PRE(sys_poll)
 
 POST(sys_poll)
 {
-   // RES is UWord so always >= 0
-   if (SUCCESS && RES >= 0) {
+   if (SUCCESS) {
       UInt i;
       struct vki_pollfd* ufds = (struct vki_pollfd *)(Addr)ARG1;
       for (i = 0; i < ARG2; i++)
index 3c45ef43b3f2c2923200d8f4133aa1f79f32d376..9794713069767f9fda0a5f95a994caae6eb5905a 100644 (file)
@@ -1264,7 +1264,7 @@ static Bool sanity_check_eclasses_in_sector ( const Sector* sec )
                 && tteC->tte2ec_ec[k] >= tteC->tte2ec_ec[k+1])
                BAD("tteC->tte2ec_ec[..] out of order");
             ec_num = tteC->tte2ec_ec[k];
-            if (ec_num < 0 || ec_num >= ECLASS_N)
+            if (ec_num >= ECLASS_N)
                BAD("tteC->tte2ec_ec[..] out of range");
             if (ec_num != i)
                continue;
index 70164245d91d8ece5cd2ffa512554275279cb071..5d8a51a132d361ecaccc3c955effc47b1db85baf 100644 (file)
@@ -503,7 +503,6 @@ Bool HG_(saneWS_SLOW) ( WordSetU* wsu, WordSet ws )
    wv = do_ix2vec( wsu, ws );
    /* can never happen .. do_ix2vec will assert instead.  Oh well. */
    if (wv->owner != wsu) return False;
-   if (wv->size < 0) return False;
    if (wv->size > 0) {
       for (i = 0; i < wv->size-1; i++) {
          if (wv->words[i] >= wv->words[i+1])