Re: [PATCH 2/2] tracing/synthetic: Bound dynamic string copy to reserved length

From: Lee Jones

Date: Wed Dec 02 2026 - 03:50:18 EST


On Tue, 01 Dec 2026, Steven Rostedt wrote:

> On Tue, 1 Dec 2026 14:29:07 +0000
> Lee Jones <lee@xxxxxxxxxx> wrote:
>
> > static unsigned int trace_string(struct synth_trace_event *entry,
> > struct synth_event *event,
> > char *str_val,
> > bool is_dynamic,
> > unsigned int data_size,
> > + u16 max_len,
> > unsigned int *n_u64)
> > {
> > unsigned int len = 0;
> > @@ -442,14 +453,13 @@ static unsigned int trace_string(struct synth_trace_event *entry,
> >
> > data->as_dynamic.offset = struct_size(entry, fields, event->n_u64) + data_size;
> >
> > - ret = fetch_store_strlen((unsigned long)str_val);
> > - if (ret <= 0) {
> > + if (!max_len) {
>
> Why not just make this into:
>
> if (!is_dynamic || !max_len) {

Thanks Steve.

I agree with your review comments and will follow-up shortly.

--
Lee Jones