lists.openwall.net | lists / announce owl-users owl-dev john-users john-dev passwdqc-users yescrypt popa3d-users / oss-security kernel-hardening musl sabotage tlsify passwords / crypt-dev xvendor / Bugtraq Full-Disclosure linux-kernel linux-netdev linux-ext4 linux-hardening linux-cve-announce PHC | |
Open Source and information security mailing list archives
| ||
|
Date: Mon, 12 Oct 2020 16:59:23 -0500 From: Tom Zanussi <zanussi@...nel.org> To: Steven Rostedt <rostedt@...dmis.org> Cc: axelrasmussen@...gle.com, mhiramat@...nel.org, linux-kernel@...r.kernel.org Subject: Re: [PATCH v2 4/7] tracing: Add synthetic event error logging Hi Steve, On Mon, 2020-10-12 at 17:49 -0400, Steven Rostedt wrote: > On Mon, 12 Oct 2020 17:42:40 -0400 > Steven Rostedt <rostedt@...dmis.org> wrote: > > > On Mon, 12 Oct 2020 15:18:06 -0500 > > Tom Zanussi <zanussi@...nel.org> wrote: > > > > > +static char last_cmd[MAX_FILTER_STR_VAL]; > > > + > > > +static int errpos(const char *str) > > > +{ > > > + return err_pos(last_cmd, str); > > > +} > > > + > > > +static void last_cmd_set(char *str) > > > +{ > > > + if (!str) > > > + return; > > > + > > > + strncat(last_cmd, str, MAX_FILTER_STR_VAL - 1); > > > > If I understand strncat() correctly, it will add 'n' + 1 bytes from > > str > > to last_cmd. That is, I think you want: > > > > strncat(last_cmd, str, MAX_FILTER_STR_VAL - (strlen(last_cmd) + > > 1)); > > > > Looking at the patch more, it only has one caller to last_cmd_set(), > and one caller to synth_err_clear(). > > Why not just clear on set? Yeah, that would make sense, or just remove the clear and use strncpy in last_cmd_set() instead. Tom > > -- Steve > > > > > > > > +} > > > + > > > +static void synth_err(u8 err_type, u8 err_pos) > > > +{ > > > + tracing_log_err(NULL, "synthetic_events", last_cmd, err_text, > > > + err_type, err_pos); > > > +} > > > + > > > +static void synth_err_clear(void) > > > +{ > > > + last_cmd[0] = '\0'; > > > +} > > > + > >
Powered by blists - more mailing lists