[DTrace-devel] [PATCH REVIEW 1/6] cg: fix calls to rand
Nick Alcock
nick.alcock at oracle.com
Thu Sep 9 04:13:40 PDT 2021
For many types of identifier, a di_id of 0 means "undefined". But for
subrs, di_id 0 is DIF_SUBR_RAND, a valid (albeit currently
unimplemented) subr.
Fixes several assertion failures running the testsute.
Signed-off-by: Nick Alcock <nick.alcock at oracle.com>
---
libdtrace/dt_cg.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
I *think* it's safe to eliminate the 0: for some types of identifier,
0 means "unset", but for DIF_SUBRs, it cannot possibly mean that
because 0 has another meaning already. I audited all assignments
to 0 and all checks of di_id for zeroness and none seemed to be
something that could ever be done to subrs, so I think we're safe.
diff --git a/libdtrace/dt_cg.c b/libdtrace/dt_cg.c
index 43ed2351d51c..467317de1a66 100644
--- a/libdtrace/dt_cg.c
+++ b/libdtrace/dt_cg.c
@@ -3186,7 +3186,7 @@ dt_cg_call_subr(dt_node_t *dnp, dt_irlist_t *dlp, dt_regset_t *drp)
"required)\n",
dt_idkind_name(idp->di_kind), idp->di_name);
- assert(idp->di_id > 0 && idp->di_id <= DIF_SUBR_MAX);
+ assert(idp->di_id <= DIF_SUBR_MAX);
fun = _dt_cg_subr[idp->di_id];
if (fun == NULL)
--
2.33.0.256.gb827f06fa9
More information about the DTrace-devel
mailing list