We don't really need to NUL-terminate the substring we are
matching against; all it takes is introducing memmem(3) and using it
instead of str[n]str().

        It's not that much work - see vfs.git#ftrace_glob.  The reason
I went there is rather amusing; it all started with making do_execve()
take arrays of const strings for argv and envp.  After all, we never
change them *and* we often enough pass arrays of string literals that
way.  It exploded into a series of 75 commits, with the final ripple
being argv_split() and argv_free().  OK, turns out that ftrace is
using those as well, fortunately it's done to get arrays of regexes,
so it should be trivial to constify as well, right?  Imagine the amount of
swearing when I noticed that it *does* modify the resulting strings...

        This series deals with that problem, providing the missing prereq for
the patchbomb from hell...

        Could you review #ftrace_glob?  It's not large - seven commits,
boiling down to
 include/linux/ftrace.h             |  8 ++---
 include/linux/string.h             |  1 +
 kernel/trace/ftrace.c              | 68 ++++++++++++++++++--------------------
 kernel/trace/trace.h               |  2 +-
 kernel/trace/trace_events_filter.c | 26 +++++++++------
 lib/string.c                       | 34 ++++++++++++-------
 6 files changed, 75 insertions(+), 64 deletions(-)

Patches in followups.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to