From: Chuhong Yuan <hslester96@gmail.com>
To: unlisted-recipients:; (no To-header on input)
Cc: Christoph Hellwig <hch@lst.de>,
Marek Szyprowski <m.szyprowski@samsung.com>,
Robin Murphy <robin.murphy@arm.com>,
Peter Oberparleiter <oberpar@linux.ibm.com>,
Davidlohr Bueso <dave@stgolabs.net>,
"Paul E . McKenney" <paulmck@linux.ibm.com>,
Josh Triplett <josh@joshtriplett.org>,
Jessica Yu <jeyu@kernel.org>,
"Rafael J . Wysocki" <rjw@rjwysocki.net>,
Pavel Machek <pavel@ucw.cz>, Len Brown <len.brown@intel.com>,
Petr Mladek <pmladek@suse.com>,
Sergey Senozhatsky <sergey.senozhatsky@gmail.com>,
Steven Rostedt <rostedt@goodmis.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Joe Perches <joe@perches.com>, Ingo Molnar <mingo@redhat.com>,
Peter Zijlstra <peterz@infradead.org>,
linux-pm@vger.kernel.org, iommu@lists.linux-foundation.org,
linux-kernel@vger.kernel.org, Chuhong Yuan <hslester96@gmail.com>
Subject: [PATCH v2 00/10] Replace strncmp with str_has_prefix
Date: Fri, 2 Aug 2019 09:46:18 +0800 [thread overview]
Message-ID: <20190802014617.8623-1-hslester96@gmail.com> (raw)
The commit 72921427d46b
("string.h: Add str_has_prefix() helper function")
introduced str_has_prefix() to substitute error-prone
strncmp(str, const, len).
strncmp(str, const, len) is easy to have error in len
because of counting error or sizeof(const) without - 1.
These patches replace such pattern with str_has_prefix()
to avoid hard coded constant length and sizeof.
Besides, str_has_prefix() returns the length of prefix
when the comparison returns true.
We can use this return value to substitute some hard-coding.
Changelog:
v1 -> v2:
- Revise the description.
- Use the return value of str_has_prefix() to eliminate
hard coding.
- Remove possible false positives and add newly detected
one in upstream.
Chuhong Yuan (10):
dma: debug: Replace strncmp with str_has_prefix
gcov: Replace strncmp with str_has_prefix
locking/locktorture: Replace strncmp with str_has_prefix
module: Replace strncmp with str_has_prefix
PM / sleep: Replace strncmp with str_has_prefix
printk: Replace strncmp with str_has_prefix
reboot: Replace strncmp with str_has_prefix
sched: Replace strncmp with str_has_prefix
userns: Replace strncmp with str_has_prefix
watchdog: Replace strncmp with str_has_prefix
kernel/dma/debug.c | 2 +-
kernel/gcov/fs.c | 2 +-
kernel/locking/locktorture.c | 8 ++++----
kernel/module.c | 2 +-
kernel/power/main.c | 2 +-
kernel/printk/braille.c | 10 ++++++----
kernel/printk/printk.c | 14 ++++++++------
kernel/reboot.c | 6 ++++--
kernel/sched/debug.c | 5 +++--
kernel/sched/isolation.c | 9 +++++----
kernel/user_namespace.c | 10 +++++-----
kernel/watchdog.c | 8 ++++----
12 files changed, 43 insertions(+), 35 deletions(-)
--
2.20.1
reply other threads:[~2019-08-02 1:46 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20190802014617.8623-1-hslester96@gmail.com \
--to=hslester96@gmail.com \
--cc=dave@stgolabs.net \
--cc=gregkh@linuxfoundation.org \
--cc=hch@lst.de \
--cc=iommu@lists.linux-foundation.org \
--cc=jeyu@kernel.org \
--cc=joe@perches.com \
--cc=josh@joshtriplett.org \
--cc=len.brown@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=m.szyprowski@samsung.com \
--cc=mingo@redhat.com \
--cc=oberpar@linux.ibm.com \
--cc=paulmck@linux.ibm.com \
--cc=pavel@ucw.cz \
--cc=peterz@infradead.org \
--cc=pmladek@suse.com \
--cc=rjw@rjwysocki.net \
--cc=robin.murphy@arm.com \
--cc=rostedt@goodmis.org \
--cc=sergey.senozhatsky@gmail.com \
/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
Powered by JetHome