]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
coverity: one dead code, one unread assignment and one NULL check
authorPaul Floyd <pjfloyd@wanadoo.fr>
Thu, 28 Mar 2024 16:14:14 +0000 (17:14 +0100)
committerPaul Floyd <pjfloyd@wanadoo.fr>
Thu, 28 Mar 2024 16:14:14 +0000 (17:14 +0100)
VEX/priv/guest_x86_helpers.c
coregrind/m_debuginfo/debuginfo.c
coregrind/m_debuginfo/readelf.c

index 7743c63a4746792745fcd0e3944629fa75940743..135e997c487888eb91dec4f7bf2d273b7e516acf 100644 (file)
@@ -2798,7 +2798,7 @@ ULong x86g_use_seg_selector ( HWord ldt, HWord gdt,
 
    /* Convert the segment selector onto a table index */
    seg_selector >>= 3;
-   vassert(seg_selector < 8192);
+   vassert(seg_selector < VEX_GUEST_X86_GDT_NENT);
 
    if (tiBit == 0) {
 
@@ -2807,10 +2807,6 @@ ULong x86g_use_seg_selector ( HWord ldt, HWord gdt,
       if (gdt == 0)
          goto bad;
 
-      /* Check for access to non-existent entry. */
-      if (seg_selector >= VEX_GUEST_X86_GDT_NENT)
-         goto bad;
-
       the_descrs = (VexGuestX86SegDescr*)gdt;
       base  = get_segdescr_base (&the_descrs[seg_selector]);
       limit = get_segdescr_limit(&the_descrs[seg_selector]);
index 5939e7b3a77cb9fbafaecf3f1e470be4934c2827..6f923c736e5b032808ab6d027efc60357db34c9b 100644 (file)
@@ -693,7 +693,6 @@ static void check_CFSI_related_invariants ( const DebugInfo* di )
                        "DiCfsi invariant (1) verification failed");
          }
       }
-      di2 = NULL;
    }
 
    /* degenerate case: all r-x sections are empty */
@@ -2822,7 +2821,7 @@ const HChar* VG_(describe_IP)(DiEpoch ep, Addr eip, const InlIPCursor *iipc)
                     ? VG_(get_fnname_w_offset) (ep, eip, &buf_fn)
                     : VG_(get_fnname) (ep, eip, &buf_fn);
    } else {
-      const DiInlLoc *next_inl = iipc && iipc->next_inltab >= 0
+      const DiInlLoc *next_inl = iipc && iipc->di && iipc->next_inltab >= 0
          ? & iipc->di->inltab[iipc->next_inltab]
          : NULL;
       vg_assert (next_inl);
index b1f863fe5994e061765045ad914f8fa42364df01..7a654e15137511caac04241aff59f04e56b9e450 100644 (file)
@@ -859,7 +859,7 @@ void read_elf_symtab__normal(
          disym.isText    = is_text;
          disym.isIFunc   = is_ifunc;
          disym.isGlobal  = is_global;
-         if (cstr) { ML_(dinfo_free)(cstr); cstr = NULL; }
+         ML_(dinfo_free)(cstr);
          vg_assert(disym.pri_name);
          vg_assert(GET_TOCPTR_AVMA(disym.avmas) == 0);
          /* has no role except on ppc64be-linux */
@@ -879,7 +879,6 @@ void read_elf_symtab__normal(
                             GET_LOCAL_EP_AVMA(disym.avmas));
            }
          }
-
       }
    }
 }