aboutsummaryrefslogtreecommitdiff
path: root/cddl/contrib
diff options
context:
space:
mode:
authorJonathan T. Looney <jtl@FreeBSD.org>2020-11-20 17:26:02 +0000
committerJonathan T. Looney <jtl@FreeBSD.org>2020-11-20 17:26:02 +0000
commit96fbe51956c9df8bdb8317413b1c487b14e4ee68 (patch)
treef20a4d8c3ebe6d4607a5bb3f1f41d272903c7c20 /cddl/contrib
parentd84134ba1cb10c7c11888248e0c1dd439bdf14c0 (diff)
downloadsrc-96fbe51956c9df8bdb8317413b1c487b14e4ee68.tar.gz
src-96fbe51956c9df8bdb8317413b1c487b14e4ee68.zip
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
Notes
Notes: svn path=/head/; revision=367905
Diffstat (limited to 'cddl/contrib')
-rw-r--r--cddl/contrib/opensolaris/common/ctf/ctf_create.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/cddl/contrib/opensolaris/common/ctf/ctf_create.c b/cddl/contrib/opensolaris/common/ctf/ctf_create.c
index 46e2b7faf437..ae4cc7f31176 100644
--- a/cddl/contrib/opensolaris/common/ctf/ctf_create.c
+++ b/cddl/contrib/opensolaris/common/ctf/ctf_create.c
@@ -615,7 +615,7 @@ ctf_add_generic(ctf_file_t *fp, uint_t flag, const char *name, ctf_dtdef_t **rp)
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 offset, void *arg)
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));
}