From owner-svn-src-stable@freebsd.org Tue Feb 11 05:14:37 2020 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A2AED24E7B4; Tue, 11 Feb 2020 05:14:37 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 48GrYT3d9kz4Vq0; Tue, 11 Feb 2020 05:14:37 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 779EF2D86; Tue, 11 Feb 2020 05:14:37 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 01B5EbvQ095949; Tue, 11 Feb 2020 05:14:37 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 01B5EaSt095945; Tue, 11 Feb 2020 05:14:36 GMT (envelope-from markj@FreeBSD.org) Message-Id: <202002110514.01B5EaSt095945@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Tue, 11 Feb 2020 05:14:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r357754 - stable/12/contrib/elftoolchain/libdwarf X-SVN-Group: stable-12 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: stable/12/contrib/elftoolchain/libdwarf X-SVN-Commit-Revision: 357754 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 11 Feb 2020 05:14:37 -0000 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 */