Date: Fri, 20 Nov 2020 17:26:02 +0000 (UTC) From: "Jonathan T. Looney" <jtl@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367905 - head/cddl/contrib/opensolaris/common/ctf Message-ID: <202011201726.0AKHQ2tl012968@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: jtl Date: Fri Nov 20 17:26:02 2020 New Revision: 367905 URL: https://svnweb.freebsd.org/changeset/base/367905 Log: When copying types from one CTF container to another, ensure that we encode 0-length (i.e. "") structure and union member names as offset 0. This ensures that we don't confuse other parts of the CTF code which expect this encoding. This resolves a Dtrace error resolving members of anonymous structs/unions within the (struct mbuf) type which some users were seeing after r366908. While here, update the code in ctf_add_generic() to encode 0-length type names as offset 0. Reviewed by: markj MFC after: 2 weeks Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D27246 Modified: head/cddl/contrib/opensolaris/common/ctf/ctf_create.c Modified: head/cddl/contrib/opensolaris/common/ctf/ctf_create.c ============================================================================== --- head/cddl/contrib/opensolaris/common/ctf/ctf_create.c Fri Nov 20 17:13:13 2020 (r367904) +++ head/cddl/contrib/opensolaris/common/ctf/ctf_create.c Fri Nov 20 17:26:02 2020 (r367905) @@ -615,7 +615,7 @@ ctf_add_generic(ctf_file_t *fp, uint_t flag, const cha if ((dtd = ctf_alloc(sizeof (ctf_dtdef_t))) == NULL) return (ctf_set_errno(fp, EAGAIN)); - if (name != NULL && (s = ctf_strdup(name)) == NULL) { + if (name != NULL && *name != '\0' && (s = ctf_strdup(name)) == NULL) { ctf_free(dtd, sizeof (ctf_dtdef_t)); return (ctf_set_errno(fp, EAGAIN)); } @@ -1217,7 +1217,7 @@ membadd(const char *name, ctf_id_t type, ulong_t offse if ((dmd = ctf_alloc(sizeof (ctf_dmdef_t))) == NULL) return (ctf_set_errno(ctb->ctb_file, EAGAIN)); - if (name != NULL && (s = ctf_strdup(name)) == NULL) { + if (name != NULL && *name != '\0' && (s = ctf_strdup(name)) == NULL) { ctf_free(dmd, sizeof (ctf_dmdef_t)); return (ctf_set_errno(ctb->ctb_file, EAGAIN)); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202011201726.0AKHQ2tl012968>