From owner-svn-src-stable@FreeBSD.ORG Sun Apr 12 21:45:35 2015 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 8BCD52DC; Sun, 12 Apr 2015 21:45:35 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5BE06C72; Sun, 12 Apr 2015 21:45:35 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t3CLjZGu033632; Sun, 12 Apr 2015 21:45:35 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t3CLjZdg033631; Sun, 12 Apr 2015 21:45:35 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201504122145.t3CLjZdg033631@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Sun, 12 Apr 2015 21:45:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r281474 - stable/10/cddl/contrib/opensolaris/common/ctf X-SVN-Group: stable-10 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.18-1 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: Sun, 12 Apr 2015 21:45:35 -0000 Author: markj Date: Sun Apr 12 21:45:34 2015 New Revision: 281474 URL: https://svnweb.freebsd.org/changeset/base/281474 Log: MFC r279862: Fix a possible infinite loop in ctf_discard(). MFC r279864: Use CTF_TYPE_TO_INDEX when comparing type indices to the dynamic type threshold. MFC r279869: If the destination container contains only a forward declaration for the input type in ctf_add_type(), search its dynamic type list before adding a new type. Modified: stable/10/cddl/contrib/opensolaris/common/ctf/ctf_create.c Directory Properties: stable/10/ (props changed) Modified: stable/10/cddl/contrib/opensolaris/common/ctf/ctf_create.c ============================================================================== --- stable/10/cddl/contrib/opensolaris/common/ctf/ctf_create.c Sun Apr 12 21:38:18 2015 (r281473) +++ stable/10/cddl/contrib/opensolaris/common/ctf/ctf_create.c Sun Apr 12 21:45:34 2015 (r281474) @@ -583,10 +583,10 @@ ctf_discard(ctf_file_t *fp) return (0); /* no update required */ for (dtd = ctf_list_prev(&fp->ctf_dtdefs); dtd != NULL; dtd = ntd) { - if (dtd->dtd_type <= fp->ctf_dtoldid) + ntd = ctf_list_prev(dtd); + if (CTF_TYPE_TO_INDEX(dtd->dtd_type) <= fp->ctf_dtoldid) continue; /* skip types that have been committed */ - ntd = ctf_list_prev(dtd); ctf_dtd_delete(fp, dtd); } @@ -1313,10 +1313,13 @@ ctf_add_type(ctf_file_t *dst_fp, ctf_fil * unless dst_type is a forward declaration and src_type is a struct, * union, or enum (i.e. the definition of the previous forward decl). */ - if (dst_type != CTF_ERR && dst_kind != kind && ( - dst_kind != CTF_K_FORWARD || (kind != CTF_K_ENUM && - kind != CTF_K_STRUCT && kind != CTF_K_UNION))) - return (ctf_set_errno(dst_fp, ECTF_CONFLICT)); + if (dst_type != CTF_ERR && dst_kind != kind) { + if (dst_kind != CTF_K_FORWARD || (kind != CTF_K_ENUM && + kind != CTF_K_STRUCT && kind != CTF_K_UNION)) + return (ctf_set_errno(dst_fp, ECTF_CONFLICT)); + else + dst_type = CTF_ERR; + } /* * If the non-empty name was not found in the appropriate hash, search @@ -1328,7 +1331,7 @@ ctf_add_type(ctf_file_t *dst_fp, ctf_fil */ if (dst_type == CTF_ERR && name[0] != '\0') { for (dtd = ctf_list_prev(&dst_fp->ctf_dtdefs); dtd != NULL && - dtd->dtd_type > dst_fp->ctf_dtoldid; + CTF_TYPE_TO_INDEX(dtd->dtd_type) > dst_fp->ctf_dtoldid; dtd = ctf_list_prev(dtd)) { if (CTF_INFO_KIND(dtd->dtd_data.ctt_info) == kind && dtd->dtd_name != NULL &&