projects
/
linux.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
d01a77a
)
kobject: Use return value of strreplace()
author
Andy Shevchenko
<andriy.shevchenko@linux.intel.com>
Mon, 5 Jun 2023 17:05:53 +0000
(20:05 +0300)
committer
Kees Cook
<keescook@chromium.org>
Mon, 5 Jun 2023 22:31:12 +0000
(15:31 -0700)
Since strreplace() returns the pointer to the string itself,
we may use it directly in the code.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Kees Cook <keescook@chromium.org>
Link:
https://lore.kernel.org/r/20230605170553.7835-4-andriy.shevchenko@linux.intel.com
lib/kobject.c
patch
|
blob
|
history
diff --git
a/lib/kobject.c
b/lib/kobject.c
index f79a434e12316608fb5dd32a1197b0d85c584740..16d530f9c174b9dd86ed4d329359b1ae7bec9585 100644
(file)
--- a/
lib/kobject.c
+++ b/
lib/kobject.c
@@
-281,8
+281,7
@@
int kobject_set_name_vargs(struct kobject *kobj, const char *fmt,
kfree_const(s);
if (!t)
return -ENOMEM;
- strreplace(t, '/', '!');
- s = t;
+ s = strreplace(t, '/', '!');
}
kfree_const(kobj->name);
kobj->name = s;