[DTrace-devel] [PATCH] Check dt_rec_add() alignment is reasonable
Kris Van Hees
kris.van.hees at oracle.com
Fri Jan 28 04:27:28 UTC 2022
On Thu, Jan 27, 2022 at 05:32:08PM -0500, eugene.loh--- via DTrace-devel wrote:
> From: Eugene Loh <eugene.loh at oracle.com>
>
> Signed-off-by: Eugene Loh <eugene.loh at oracle.com>
Reviewed-by: Kris Van Hees <kris.van.hees at oracle.com>
... with small change below...
> ---
> libdtrace/dt_map.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/libdtrace/dt_map.c b/libdtrace/dt_map.c
> index b7f067fb..70e7b03b 100644
> --- a/libdtrace/dt_map.c
> +++ b/libdtrace/dt_map.c
> @@ -190,6 +190,9 @@ dt_rec_add(dtrace_hdl_t *dtp, dt_cg_gap_f gapf, dtrace_actkind_t kind,
> int cnt, max;
>
> assert(gapf);
> + assert(alignment > 0
> + && alignment <= 8
> + && (alignment & (alignment - 1)) == 0);
I think you should make this:
+ assert(alignment > 0 && alignment <= 8 &&
+ (alignment & (alignment - 1)) == 0);
That puts the main boundary checks on the same line, and aligns the two
distinct parts of the conditional expression.
>
> /* make more space if necessary */
> cnt = ddp->dtdd_nrecs + 1;
> --
> 2.18.4
>
>
> _______________________________________________
> 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