From: Paul Floyd Date: Thu, 28 Mar 2024 16:14:14 +0000 (+0100) Subject: coverity: one dead code, one unread assignment and one NULL check X-Git-Tag: VALGRIND_3_23_0~87 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e65c8cc7098e16616668ed2f91abe8b40fdd1533;p=thirdparty%2Fvalgrind.git coverity: one dead code, one unread assignment and one NULL check --- diff --git a/VEX/priv/guest_x86_helpers.c b/VEX/priv/guest_x86_helpers.c index 7743c63a4..135e997c4 100644 --- a/VEX/priv/guest_x86_helpers.c +++ b/VEX/priv/guest_x86_helpers.c @@ -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]); diff --git a/coregrind/m_debuginfo/debuginfo.c b/coregrind/m_debuginfo/debuginfo.c index 5939e7b3a..6f923c736 100644 --- a/coregrind/m_debuginfo/debuginfo.c +++ b/coregrind/m_debuginfo/debuginfo.c @@ -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); diff --git a/coregrind/m_debuginfo/readelf.c b/coregrind/m_debuginfo/readelf.c index b1f863fe5..7a654e151 100644 --- a/coregrind/m_debuginfo/readelf.c +++ b/coregrind/m_debuginfo/readelf.c @@ -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)); } } - } } }