sizeof(*var) instead of sizeof(type)diff -r1.14 -r1.15 src/external/cddl/osnet/dev/dtrace/amd64/dtrace_subr.c
(simonb)
--- src/external/cddl/osnet/dev/dtrace/amd64/dtrace_subr.c 2019/11/08 11:06:21 1.14
+++ src/external/cddl/osnet/dev/dtrace/amd64/dtrace_subr.c 2021/04/06 12:48:59 1.15
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: dtrace_subr.c,v 1.14 2019/11/08 11:06:21 hannken Exp $ */ | 1 | /* $NetBSD: dtrace_subr.c,v 1.15 2021/04/06 12:48:59 simonb Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * CDDL HEADER START | 4 | * CDDL HEADER START | |
5 | * | 5 | * | |
6 | * The contents of this file are subject to the terms of the | 6 | * The contents of this file are subject to the terms of the | |
7 | * Common Development and Distribution License, Version 1.0 only | 7 | * Common Development and Distribution License, Version 1.0 only | |
8 | * (the "License"). You may not use this file except in compliance | 8 | * (the "License"). You may not use this file except in compliance | |
9 | * with the License. | 9 | * with the License. | |
10 | * | 10 | * | |
11 | * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE | 11 | * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE | |
12 | * or http://www.opensolaris.org/os/licensing. | 12 | * or http://www.opensolaris.org/os/licensing. | |
13 | * See the License for the specific language governing permissions | 13 | * See the License for the specific language governing permissions | |
14 | * and limitations under the License. | 14 | * and limitations under the License. | |
@@ -68,27 +68,27 @@ dtrace_invop(uintptr_t addr, struct trap | @@ -68,27 +68,27 @@ dtrace_invop(uintptr_t addr, struct trap | |||
68 | 68 | |||
69 | for (hdlr = dtrace_invop_hdlr; hdlr != NULL; hdlr = hdlr->dtih_next) | 69 | for (hdlr = dtrace_invop_hdlr; hdlr != NULL; hdlr = hdlr->dtih_next) | |
70 | if ((rval = hdlr->dtih_func(addr, frame, eax)) != 0) | 70 | if ((rval = hdlr->dtih_func(addr, frame, eax)) != 0) | |
71 | return (rval); | 71 | return (rval); | |
72 | 72 | |||
73 | return (0); | 73 | return (0); | |
74 | } | 74 | } | |
75 | 75 | |||
76 | void | 76 | void | |
77 | dtrace_invop_add(int (*func)(uintptr_t, struct trapframe *, uintptr_t)) | 77 | dtrace_invop_add(int (*func)(uintptr_t, struct trapframe *, uintptr_t)) | |
78 | { | 78 | { | |
79 | dtrace_invop_hdlr_t *hdlr; | 79 | dtrace_invop_hdlr_t *hdlr; | |
80 | 80 | |||
81 | hdlr = kmem_alloc(sizeof (dtrace_invop_hdlr_t), KM_SLEEP); | 81 | hdlr = kmem_alloc(sizeof(*hdlr), KM_SLEEP); | |
82 | hdlr->dtih_func = func; | 82 | hdlr->dtih_func = func; | |
83 | hdlr->dtih_next = dtrace_invop_hdlr; | 83 | hdlr->dtih_next = dtrace_invop_hdlr; | |
84 | dtrace_invop_hdlr = hdlr; | 84 | dtrace_invop_hdlr = hdlr; | |
85 | } | 85 | } | |
86 | 86 | |||
87 | void | 87 | void | |
88 | dtrace_invop_remove(int (*func)(uintptr_t, struct trapframe *, uintptr_t)) | 88 | dtrace_invop_remove(int (*func)(uintptr_t, struct trapframe *, uintptr_t)) | |
89 | { | 89 | { | |
90 | dtrace_invop_hdlr_t *hdlr = dtrace_invop_hdlr, *prev = NULL; | 90 | dtrace_invop_hdlr_t *hdlr = dtrace_invop_hdlr, *prev = NULL; | |
91 | 91 | |||
92 | for (;;) { | 92 | for (;;) { | |
93 | if (hdlr == NULL) | 93 | if (hdlr == NULL) | |
94 | panic("attempt to remove non-existent invop handler"); | 94 | panic("attempt to remove non-existent invop handler"); | |
@@ -98,27 +98,27 @@ dtrace_invop_remove(int (*func)(uintptr_ | @@ -98,27 +98,27 @@ dtrace_invop_remove(int (*func)(uintptr_ | |||
98 | 98 | |||
99 | prev = hdlr; | 99 | prev = hdlr; | |
100 | hdlr = hdlr->dtih_next; | 100 | hdlr = hdlr->dtih_next; | |
101 | } | 101 | } | |
102 | 102 | |||
103 | if (prev == NULL) { | 103 | if (prev == NULL) { | |
104 | ASSERT(dtrace_invop_hdlr == hdlr); | 104 | ASSERT(dtrace_invop_hdlr == hdlr); | |
105 | dtrace_invop_hdlr = hdlr->dtih_next; | 105 | dtrace_invop_hdlr = hdlr->dtih_next; | |
106 | } else { | 106 | } else { | |
107 | ASSERT(dtrace_invop_hdlr != hdlr); | 107 | ASSERT(dtrace_invop_hdlr != hdlr); | |
108 | prev->dtih_next = hdlr->dtih_next; | 108 | prev->dtih_next = hdlr->dtih_next; | |
109 | } | 109 | } | |
110 | 110 | |||
111 | kmem_free(hdlr, sizeof (dtrace_invop_hdlr_t)); | 111 | kmem_free(hdlr, sizeof(*hdlr)); | |
112 | } | 112 | } | |
113 | 113 | |||
114 | /*ARGSUSED*/ | 114 | /*ARGSUSED*/ | |
115 | void | 115 | void | |
116 | dtrace_toxic_ranges(void (*func)(uintptr_t base, uintptr_t limit)) | 116 | dtrace_toxic_ranges(void (*func)(uintptr_t base, uintptr_t limit)) | |
117 | { | 117 | { | |
118 | (*func)(0, VM_MIN_KERNEL_ADDRESS_DEFAULT); | 118 | (*func)(0, VM_MIN_KERNEL_ADDRESS_DEFAULT); | |
119 | } | 119 | } | |
120 | 120 | |||
121 | static void | 121 | static void | |
122 | xcall_func(void *arg0, void *arg1) | 122 | xcall_func(void *arg0, void *arg1) | |
123 | { | 123 | { | |
124 | dtrace_xcall_t func = arg0; | 124 | dtrace_xcall_t func = arg0; |
--- src/external/cddl/osnet/dev/dtrace/arm/dtrace_subr.c 2018/05/28 21:05:03 1.4
+++ src/external/cddl/osnet/dev/dtrace/arm/dtrace_subr.c 2021/04/06 12:48:59 1.5
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: dtrace_subr.c,v 1.4 2018/05/28 21:05:03 chs Exp $ */ | 1 | /* $NetBSD: dtrace_subr.c,v 1.5 2021/04/06 12:48:59 simonb Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * CDDL HEADER START | 4 | * CDDL HEADER START | |
5 | * | 5 | * | |
6 | * The contents of this file are subject to the terms of the | 6 | * The contents of this file are subject to the terms of the | |
7 | * Common Development and Distribution License, Version 1.0 only | 7 | * Common Development and Distribution License, Version 1.0 only | |
8 | * (the "License"). You may not use this file except in compliance | 8 | * (the "License"). You may not use this file except in compliance | |
9 | * with the License. | 9 | * with the License. | |
10 | * | 10 | * | |
11 | * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE | 11 | * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE | |
12 | * or http://www.opensolaris.org/os/licensing. | 12 | * or http://www.opensolaris.org/os/licensing. | |
13 | * See the License for the specific language governing permissions | 13 | * See the License for the specific language governing permissions | |
14 | * and limitations under the License. | 14 | * and limitations under the License. | |
@@ -84,27 +84,27 @@ dtrace_invop(uintptr_t addr, struct trap | @@ -84,27 +84,27 @@ dtrace_invop(uintptr_t addr, struct trap | |||
84 | for (hdlr = dtrace_invop_hdlr; hdlr != NULL; hdlr = hdlr->dtih_next) | 84 | for (hdlr = dtrace_invop_hdlr; hdlr != NULL; hdlr = hdlr->dtih_next) | |
85 | if ((rval = hdlr->dtih_func(addr, frame, eax)) != 0) | 85 | if ((rval = hdlr->dtih_func(addr, frame, eax)) != 0) | |
86 | return (rval); | 86 | return (rval); | |
87 | 87 | |||
88 | return (0); | 88 | return (0); | |
89 | } | 89 | } | |
90 | 90 | |||
91 | 91 | |||
92 | void | 92 | void | |
93 | dtrace_invop_add(int (*func)(uintptr_t, struct trapframe *, uintptr_t)) | 93 | dtrace_invop_add(int (*func)(uintptr_t, struct trapframe *, uintptr_t)) | |
94 | { | 94 | { | |
95 | dtrace_invop_hdlr_t *hdlr; | 95 | dtrace_invop_hdlr_t *hdlr; | |
96 | 96 | |||
97 | hdlr = kmem_alloc(sizeof (dtrace_invop_hdlr_t), KM_SLEEP); | 97 | hdlr = kmem_alloc(sizeof(*hdlr), KM_SLEEP); | |
98 | hdlr->dtih_func = func; | 98 | hdlr->dtih_func = func; | |
99 | hdlr->dtih_next = dtrace_invop_hdlr; | 99 | hdlr->dtih_next = dtrace_invop_hdlr; | |
100 | dtrace_invop_hdlr = hdlr; | 100 | dtrace_invop_hdlr = hdlr; | |
101 | } | 101 | } | |
102 | 102 | |||
103 | void | 103 | void | |
104 | dtrace_invop_remove(int (*func)(uintptr_t, struct trapframe *, uintptr_t)) | 104 | dtrace_invop_remove(int (*func)(uintptr_t, struct trapframe *, uintptr_t)) | |
105 | { | 105 | { | |
106 | dtrace_invop_hdlr_t *hdlr = dtrace_invop_hdlr, *prev = NULL; | 106 | dtrace_invop_hdlr_t *hdlr = dtrace_invop_hdlr, *prev = NULL; | |
107 | 107 | |||
108 | for (;;) { | 108 | for (;;) { | |
109 | if (hdlr == NULL) | 109 | if (hdlr == NULL) | |
110 | panic("attempt to remove non-existent invop handler"); | 110 | panic("attempt to remove non-existent invop handler"); | |
@@ -114,27 +114,27 @@ dtrace_invop_remove(int (*func)(uintptr_ | @@ -114,27 +114,27 @@ dtrace_invop_remove(int (*func)(uintptr_ | |||
114 | 114 | |||
115 | prev = hdlr; | 115 | prev = hdlr; | |
116 | hdlr = hdlr->dtih_next; | 116 | hdlr = hdlr->dtih_next; | |
117 | } | 117 | } | |
118 | 118 | |||
119 | if (prev == NULL) { | 119 | if (prev == NULL) { | |
120 | ASSERT(dtrace_invop_hdlr == hdlr); | 120 | ASSERT(dtrace_invop_hdlr == hdlr); | |
121 | dtrace_invop_hdlr = hdlr->dtih_next; | 121 | dtrace_invop_hdlr = hdlr->dtih_next; | |
122 | } else { | 122 | } else { | |
123 | ASSERT(dtrace_invop_hdlr != hdlr); | 123 | ASSERT(dtrace_invop_hdlr != hdlr); | |
124 | prev->dtih_next = hdlr->dtih_next; | 124 | prev->dtih_next = hdlr->dtih_next; | |
125 | } | 125 | } | |
126 | 126 | |||
127 | kmem_free(hdlr, sizeof (dtrace_invop_hdlr_t)); | 127 | kmem_free(hdlr, sizeof(*hdlr)); | |
128 | } | 128 | } | |
129 | 129 | |||
130 | /*ARGSUSED*/ | 130 | /*ARGSUSED*/ | |
131 | void | 131 | void | |
132 | dtrace_toxic_ranges(void (*func)(uintptr_t base, uintptr_t limit)) | 132 | dtrace_toxic_ranges(void (*func)(uintptr_t base, uintptr_t limit)) | |
133 | { | 133 | { | |
134 | (*func)(0, kernelbase); | 134 | (*func)(0, kernelbase); | |
135 | } | 135 | } | |
136 | 136 | |||
137 | static void | 137 | static void | |
138 | xcall_func(void *arg0, void *arg1) | 138 | xcall_func(void *arg0, void *arg1) | |
139 | { | 139 | { | |
140 | dtrace_xcall_t func = arg0; | 140 | dtrace_xcall_t func = arg0; |
--- src/external/cddl/osnet/dev/dtrace/i386/dtrace_subr.c 2019/02/13 08:46:40 1.12
+++ src/external/cddl/osnet/dev/dtrace/i386/dtrace_subr.c 2021/04/06 12:48:59 1.13
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: dtrace_subr.c,v 1.12 2019/02/13 08:46:40 rin Exp $ */ | 1 | /* $NetBSD: dtrace_subr.c,v 1.13 2021/04/06 12:48:59 simonb Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * CDDL HEADER START | 4 | * CDDL HEADER START | |
5 | * | 5 | * | |
6 | * The contents of this file are subject to the terms of the | 6 | * The contents of this file are subject to the terms of the | |
7 | * Common Development and Distribution License, Version 1.0 only | 7 | * Common Development and Distribution License, Version 1.0 only | |
8 | * (the "License"). You may not use this file except in compliance | 8 | * (the "License"). You may not use this file except in compliance | |
9 | * with the License. | 9 | * with the License. | |
10 | * | 10 | * | |
11 | * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE | 11 | * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE | |
12 | * or http://www.opensolaris.org/os/licensing. | 12 | * or http://www.opensolaris.org/os/licensing. | |
13 | * See the License for the specific language governing permissions | 13 | * See the License for the specific language governing permissions | |
14 | * and limitations under the License. | 14 | * and limitations under the License. | |
@@ -76,27 +76,27 @@ dtrace_invop(uintptr_t addr, struct trap | @@ -76,27 +76,27 @@ dtrace_invop(uintptr_t addr, struct trap | |||
76 | 76 | |||
77 | for (hdlr = dtrace_invop_hdlr; hdlr != NULL; hdlr = hdlr->dtih_next) | 77 | for (hdlr = dtrace_invop_hdlr; hdlr != NULL; hdlr = hdlr->dtih_next) | |
78 | if ((rval = hdlr->dtih_func(addr, frame, eax)) != 0) | 78 | if ((rval = hdlr->dtih_func(addr, frame, eax)) != 0) | |
79 | return (rval); | 79 | return (rval); | |
80 | 80 | |||
81 | return (0); | 81 | return (0); | |
82 | } | 82 | } | |
83 | 83 | |||
84 | void | 84 | void | |
85 | dtrace_invop_add(int (*func)(uintptr_t, struct trapframe *, uintptr_t)) | 85 | dtrace_invop_add(int (*func)(uintptr_t, struct trapframe *, uintptr_t)) | |
86 | { | 86 | { | |
87 | dtrace_invop_hdlr_t *hdlr; | 87 | dtrace_invop_hdlr_t *hdlr; | |
88 | 88 | |||
89 | hdlr = kmem_alloc(sizeof (dtrace_invop_hdlr_t), KM_SLEEP); | 89 | hdlr = kmem_alloc(sizeof(*hdlr), KM_SLEEP); | |
90 | hdlr->dtih_func = func; | 90 | hdlr->dtih_func = func; | |
91 | hdlr->dtih_next = dtrace_invop_hdlr; | 91 | hdlr->dtih_next = dtrace_invop_hdlr; | |
92 | dtrace_invop_hdlr = hdlr; | 92 | dtrace_invop_hdlr = hdlr; | |
93 | } | 93 | } | |
94 | 94 | |||
95 | void | 95 | void | |
96 | dtrace_invop_remove(int (*func)(uintptr_t, struct trapframe *, uintptr_t)) | 96 | dtrace_invop_remove(int (*func)(uintptr_t, struct trapframe *, uintptr_t)) | |
97 | { | 97 | { | |
98 | dtrace_invop_hdlr_t *hdlr = dtrace_invop_hdlr, *prev = NULL; | 98 | dtrace_invop_hdlr_t *hdlr = dtrace_invop_hdlr, *prev = NULL; | |
99 | 99 | |||
100 | for (;;) { | 100 | for (;;) { | |
101 | if (hdlr == NULL) | 101 | if (hdlr == NULL) | |
102 | panic("attempt to remove non-existent invop handler"); | 102 | panic("attempt to remove non-existent invop handler"); | |
@@ -106,27 +106,27 @@ dtrace_invop_remove(int (*func)(uintptr_ | @@ -106,27 +106,27 @@ dtrace_invop_remove(int (*func)(uintptr_ | |||
106 | 106 | |||
107 | prev = hdlr; | 107 | prev = hdlr; | |
108 | hdlr = hdlr->dtih_next; | 108 | hdlr = hdlr->dtih_next; | |
109 | } | 109 | } | |
110 | 110 | |||
111 | if (prev == NULL) { | 111 | if (prev == NULL) { | |
112 | ASSERT(dtrace_invop_hdlr == hdlr); | 112 | ASSERT(dtrace_invop_hdlr == hdlr); | |
113 | dtrace_invop_hdlr = hdlr->dtih_next; | 113 | dtrace_invop_hdlr = hdlr->dtih_next; | |
114 | } else { | 114 | } else { | |
115 | ASSERT(dtrace_invop_hdlr != hdlr); | 115 | ASSERT(dtrace_invop_hdlr != hdlr); | |
116 | prev->dtih_next = hdlr->dtih_next; | 116 | prev->dtih_next = hdlr->dtih_next; | |
117 | } | 117 | } | |
118 | 118 | |||
119 | kmem_free(hdlr, sizeof (dtrace_invop_hdlr_t)); | 119 | kmem_free(hdlr, sizeof(*hdlr)); | |
120 | } | 120 | } | |
121 | 121 | |||
122 | void | 122 | void | |
123 | dtrace_toxic_ranges(void (*func)(uintptr_t base, uintptr_t limit)) | 123 | dtrace_toxic_ranges(void (*func)(uintptr_t base, uintptr_t limit)) | |
124 | { | 124 | { | |
125 | (*func)(0, kernelbase); | 125 | (*func)(0, kernelbase); | |
126 | } | 126 | } | |
127 | 127 | |||
128 | static void | 128 | static void | |
129 | xcall_func(void *arg0, void *arg1) | 129 | xcall_func(void *arg0, void *arg1) | |
130 | { | 130 | { | |
131 | dtrace_xcall_t func = arg0; | 131 | dtrace_xcall_t func = arg0; | |
132 | 132 |