Messages in this thread | | | Date | Tue, 16 Nov 2021 14:01:52 -0500 | From | Steven Rostedt <> | Subject | Re: [PATCH] tracing/histogram: Do not copy the fixed-size char array field over the field size |
| |
[ Resending to linux-kernel instead of ilinux-kernel ]
On Tue, 16 Nov 2021 13:34:31 -0500 Steven Rostedt <rostedt@goodmis.org> wrote:
> On Tue, 16 Nov 2021 09:53:59 -0800 > Beau Belgrave <beaub@linux.microsoft.com> wrote: > > > > @@ -3025,7 +3026,7 @@ static inline void __update_field_vars(struct tracing_map_elt *elt, > > > char *str = elt_data->field_var_str[j++]; > > > char *val_str = (char *)(uintptr_t)var_val; > > > > > > - strscpy(str, val_str, STR_VAR_LEN_MAX); > > > + strscpy(str, val_str, val->size); > > > > Is it possible for val->size to be larger than STR_VAR_LEN_MAX? > > field_var_str is alloc'd to be the size of STR_VAR_LEN_MAX (256). > > Yes. > > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=938aa33f14657c9ed9deea348b7d6f14b6d69cb7 > > ;-) > > -- Steve > > > > > > var_val = (u64)(uintptr_t)str; > > > } > > > tracing_map_set_var(elt, var_idx, var_val); > > > @@ -4920,7 +4921,7 @@ static void hist_trigger_elt_update(struct hist_trigger_data *hist_data, > > > > > > str = elt_data->field_var_str[idx]; > > > val_str = (char *)(uintptr_t)hist_val; > > > - strscpy(str, val_str, STR_VAR_LEN_MAX); > > > + strscpy(str, val_str, hist_field->size); > > > > Same as above. >
| |