Replace strncmp with str_has_prefix
Status from this message: Applied, thanks!
Get series with b4
b4 am [email protected]Versions newest first · linked by author and title
- v4 Latest8 patches 9 repliesApplied
- v38 patches 1 replySuperseded
- v2 posting 2/210 patches 3 repliesApplied
Earlier versions · 2
| Version | Posted | Patches | Replies | Status |
|---|---|---|---|---|
| v2 posting 1/2 | 1 patch | 0 replies | Superseded | |
| v1 | 1 patch | 1 reply | Superseded |
Changes in v4 from the cover letter
- Eliminate assignments in if conditions.
Patches in v4 Applied
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/8 | dma: debug: Replace strncmp with str_has_prefixkernel/ | +1 | 0 replies | |
| 2/8 | module: Replace strncmp with str_has_prefixkernel/ | +1 | 0 replies | |
| 3/8 | PM/sleep: Replace strncmp with str_has_prefixkernel/ | +1 | 1 reply | |
| 4/8 | printk: Replace strncmp with str_has_prefixkernel/ kernel/ | +27 | 5 replies | |
| 5/8 | reboot: Replace strncmp with str_has_prefixkernel/ | +5 | 0 replies | |
| 6/8 | sched: Replace strncmp with str_has_prefixkernel/ kernel/ | +11 | 3 replies | |
| 7/8 | userns: Replace strncmp with str_has_prefixkernel/ | +12 | 0 replies | |
| 8/8 | watchdog: Replace strncmp with str_has_prefixkernel/ | +4 | 0 replies |
Reviews trailers per patch
2 of 8 patches have a Reviewed-by or Acked-by.
| Patch | Valentin Schneider | Petr Mladek | Sergey Senozhatsky |
|---|---|---|---|
| 1/8 | |||
| 2/8 | |||
| 3/8 | |||
| 4/8 | R-b | R-b | |
| 5/8 | |||
| 6/8 | R-b | ||
| 7/8 | |||
| 8/8 |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 3 reviewers.
Cover letter [PATCH v4 0/8] Replace strncmp with str_has_prefix
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.
v2 -> v3:
- Revise the description.
- Remove else uses in printk.c.
v3 -> v4:
- Eliminate assignments in if conditions.
Chuhong Yuan (8):
dma: debug: 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/module.c | 2 +- kernel/power/main.c | 2 +- kernel/printk/braille.c | 15 +++++++++++---- kernel/printk/printk.c | 22 ++++++++++++++++------ kernel/reboot.c | 7 +++++-- kernel/sched/debug.c | 6 ++++-- kernel/sched/isolation.c | 11 +++++++---- kernel/user_namespace.c | 20 ++++++++++++-------- kernel/watchdog.c | 8 ++++---- 10 files changed, 62 insertions(+), 33 deletions(-)
Signature · 1 line
2.20.1