svn commit: r357754 - stable/12/contrib/elftoolchain/libdwarf
Mark Johnston
markj at FreeBSD.org
Tue Feb 11 05:14:37 UTC 2020
Author: markj
Date: Tue Feb 11 05:14:36 2020
New Revision: 357754
URL: https://svnweb.freebsd.org/changeset/base/357754
Log:
MFC r357531, r357532, r357533, r357534:
libdwarf: Coverity fixups.
Modified:
stable/12/contrib/elftoolchain/libdwarf/dwarf_pro_attr.c
stable/12/contrib/elftoolchain/libdwarf/dwarf_pro_expr.c
stable/12/contrib/elftoolchain/libdwarf/libdwarf_abbrev.c
stable/12/contrib/elftoolchain/libdwarf/libdwarf_frame.c
Directory Properties:
stable/12/ (props changed)
Modified: stable/12/contrib/elftoolchain/libdwarf/dwarf_pro_attr.c
==============================================================================
--- stable/12/contrib/elftoolchain/libdwarf/dwarf_pro_attr.c Tue Feb 11 05:13:35 2020 (r357753)
+++ stable/12/contrib/elftoolchain/libdwarf/dwarf_pro_attr.c Tue Feb 11 05:14:36 2020 (r357754)
@@ -46,8 +46,10 @@ dwarf_add_AT_location_expr(Dwarf_P_Debug dbg, Dwarf_P_
at->at_attrib = attr;
at->at_expr = loc_expr;
- if (_dwarf_expr_into_block(loc_expr, error) != DW_DLE_NONE)
+ if (_dwarf_expr_into_block(loc_expr, error) != DW_DLE_NONE) {
+ free(at);
return (DW_DLV_BADADDR);
+ }
at->u[0].u64 = loc_expr->pe_length;
at->u[1].u8p = loc_expr->pe_block;
if (loc_expr->pe_length <= UCHAR_MAX)
Modified: stable/12/contrib/elftoolchain/libdwarf/dwarf_pro_expr.c
==============================================================================
--- stable/12/contrib/elftoolchain/libdwarf/dwarf_pro_expr.c Tue Feb 11 05:13:35 2020 (r357753)
+++ stable/12/contrib/elftoolchain/libdwarf/dwarf_pro_expr.c Tue Feb 11 05:14:36 2020 (r357754)
@@ -36,10 +36,10 @@ _dwarf_add_expr(Dwarf_P_Expr expr, Dwarf_Small opcode,
Dwarf_Debug dbg;
int len;
- dbg = expr != NULL ? expr->pe_dbg : NULL;
+ dbg = expr->pe_dbg;
- if (_dwarf_loc_expr_add_atom(expr->pe_dbg, NULL, NULL, opcode, val1,
- val2, &len, error) != DW_DLE_NONE)
+ if (_dwarf_loc_expr_add_atom(dbg, NULL, NULL, opcode, val1, val2, &len,
+ error) != DW_DLE_NONE)
return (NULL);
assert(len > 0);
@@ -67,7 +67,7 @@ _dwarf_expr_into_block(Dwarf_P_Expr expr, Dwarf_Error
Dwarf_Debug dbg;
int len, pos, ret;
- dbg = expr != NULL ? expr->pe_dbg : NULL;
+ dbg = expr->pe_dbg;
if (expr->pe_block != NULL) {
free(expr->pe_block);
@@ -88,7 +88,7 @@ _dwarf_expr_into_block(Dwarf_P_Expr expr, Dwarf_Error
pos = 0;
STAILQ_FOREACH(ee, &expr->pe_eelist, ee_next) {
assert((Dwarf_Unsigned) pos < expr->pe_length);
- ret = _dwarf_loc_expr_add_atom(expr->pe_dbg,
+ ret = _dwarf_loc_expr_add_atom(dbg,
&expr->pe_block[pos], &expr->pe_block[expr->pe_length],
ee->ee_loc.lr_atom, ee->ee_loc.lr_number,
ee->ee_loc.lr_number2, &len, error);
Modified: stable/12/contrib/elftoolchain/libdwarf/libdwarf_abbrev.c
==============================================================================
--- stable/12/contrib/elftoolchain/libdwarf/libdwarf_abbrev.c Tue Feb 11 05:13:35 2020 (r357753)
+++ stable/12/contrib/elftoolchain/libdwarf/libdwarf_abbrev.c Tue Feb 11 05:14:36 2020 (r357754)
@@ -59,9 +59,7 @@ _dwarf_abbrev_add(Dwarf_CU cu, uint64_t entry, uint64_
HASH_ADD(ab_hh, cu->cu_abbrev_hash, ab_entry,
sizeof(ab->ab_entry), ab);
- if (abp != NULL)
- *abp = ab;
-
+ *abp = ab;
return (DW_DLE_NONE);
}
Modified: stable/12/contrib/elftoolchain/libdwarf/libdwarf_frame.c
==============================================================================
--- stable/12/contrib/elftoolchain/libdwarf/libdwarf_frame.c Tue Feb 11 05:13:35 2020 (r357753)
+++ stable/12/contrib/elftoolchain/libdwarf/libdwarf_frame.c Tue Feb 11 05:14:36 2020 (r357754)
@@ -468,9 +468,9 @@ _dwarf_frame_section_init(Dwarf_Debug dbg, Dwarf_Frame
if (length > ds->ds_size - offset ||
(length == 0 && !eh_frame)) {
- DWARF_SET_ERROR(dbg, error,
- DW_DLE_DEBUG_FRAME_LENGTH_BAD);
- return (DW_DLE_DEBUG_FRAME_LENGTH_BAD);
+ ret = DW_DLE_DEBUG_FRAME_LENGTH_BAD;
+ DWARF_SET_ERROR(dbg, error, ret);
+ goto fail_cleanup;
}
/* Check terminator for .eh_frame */
More information about the svn-src-stable-12
mailing list