[DTrace-devel] [PATCH REVIEW 1/6] cg: fix calls to rand
Kris Van Hees
kris.van.hees at oracle.com
Wed Sep 29 14:14:59 PDT 2021
Reviewed-by: Kris Van Hees (kris.van.hees at oracle.com>
... and I added it to the 'dev' branch already.
On Thu, Sep 09, 2021 at 12:13:40PM +0100, Nick Alcock wrote:
> 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
>
>
> _______________________________________________
> DTrace-devel mailing list
> DTrace-devel at oss.oracle.com
> https://oss.oracle.com/mailman/listinfo/dtrace-devel
More information about the DTrace-devel
mailing list