From: Joe Perches <joe@perches.com>
To: Bryana Rostedt <bryana@home.goodmis.org>,
LKML <linux-kernel@vger.kernel.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
Andrew Morton <akpm@linux-foundation.org>,
Ingo Molnar <mingo@kernel.org>, Tom Zanussi <zanussi@kernel.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Alexander Shishkin <alexander.shishkin@linux.intel.com>
Subject: Re: [RFC][PATCH] string.h: Add strncmp_prefix() helper macro
Date: Wed, 19 Dec 2018 14:05:32 -0800 [thread overview]
Message-ID: <a5a26ed80402a0abdc83dffc2e7fb28b0b96450f.camel@perches.com> (raw)
In-Reply-To: <20181219163207.792e0f97@gandalf.local.home>
On Wed, 2018-12-19 at 16:32 -0500, Bryana Rostedt wrote:
> a quick grep in the kernel tree found several
> (thousands!) of cases that use this construct. A quick grep also
> revealed that there's probably several bugs in that use case. Some are
> that people forgot the "- 1" (which I found) and others could be that
> the constant for the sizeof is different than the constant (although, I
> haven't found any of those, but I also didn't look hard).
Several dozen cases exist like strncmp(foo, "bar", 4)
where it might as well use strcmp instead.
And a few mismatches exist like:
drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c:2285: if (!strncmp(opt, "eee_timer:", 6)) {
tools/power/x86/x86_energy_perf_policy/x86_energy_perf_policy.c:318: if (!strncmp(s, "power", 9))
tools/power/x86/x86_energy_perf_policy/x86_energy_perf_policy.c:321: if (!strncmp(s, "balance-power", 17))
j
next prev parent reply other threads:[~2018-12-19 22:05 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-19 21:32 Bryana Rostedt
2018-12-19 21:54 ` Joe Perches
2018-12-19 22:21 ` Steven Rostedt
2018-12-20 1:43 ` Steven Rostedt
2018-12-19 22:05 ` Joe Perches [this message]
2018-12-20 1:46 ` Steven Rostedt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=a5a26ed80402a0abdc83dffc2e7fb28b0b96450f.camel@perches.com \
--to=joe@perches.com \
--cc=akpm@linux-foundation.org \
--cc=alexander.shishkin@linux.intel.com \
--cc=bryana@home.goodmis.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=torvalds@linux-foundation.org \
--cc=zanussi@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®