[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20181219160317.71c3e3ff@gandalf.local.home>
Date: Wed, 19 Dec 2018 16:03:17 -0500
From: Steven Rostedt <rostedt@...dmis.org>
To: Joe Perches <joe@...ches.com>
Cc: Tom Zanussi <zanussi@...nel.org>, tglx@...utronix.de,
mhiramat@...nel.org, namhyung@...nel.org, vedang.patel@...el.com,
bigeasy@...utronix.de, joel@...lfernandes.org,
mathieu.desnoyers@...icios.com, julia@...com,
linux-kernel@...r.kernel.org, linux-rt-users@...r.kernel.org
Subject: Re: [PATCH 2/7] tracing: Change strlen to sizeof for hist trigger
static strings
On Wed, 19 Dec 2018 12:51:59 -0800
Joe Perches <joe@...ches.com> wrote:
> > #define strncmp_prefix(str, prefix) \
> > strncmp(str, prefix, strlen(prefix))
> >
> > in include/linux/string.h
> >
> > And go around and use that throughout the kernel. By doing a quick
> > grep, I already spotted a few bugs.
>
> I hope you also convert the existing uses like
>
> strncmp(str1, "str2", 4)
>
> where the length value is precalculated to the strlen
> of the const string
Yeah sure.
>
> But there seem to be _a lot_ of those...
>
> $ git grep -P "\bstrncmp\s*\([^,]+,[^,]+,\s*\d+\s*\)" | wc -l
> 1681
>
Right.
I'm going to first create the macro and probably just apply it to the
tracing directory. Then when the macro is added to the next merge
window, I'll post a bunch of patches that clean up the rest of the code.
-- Steve
Powered by blists - more mailing lists