aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndy Shevchenko <[email protected]>2023-06-05 20:05:53 +0300
committerKees Cook <[email protected]>2023-06-05 15:31:12 -0700
commitb2f10148ec1eae7d63dd6a1a56afdf93a27daa74 (patch)
tree59afb19b3127ae8d2f8dddd75d6a3c2de3c4c362
parentd01a77afd6bef1b3a2ed15e8ca6887ca7da0cddc (diff)
kobject: Use return value of strreplace()
Since strreplace() returns the pointer to the string itself, we may use it directly in the code. Signed-off-by: Andy Shevchenko <[email protected]> Signed-off-by: Kees Cook <[email protected]> Link: https://lore.kernel.org/r/[email protected]
-rw-r--r--lib/kobject.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/lib/kobject.c b/lib/kobject.c
index f79a434e1231..16d530f9c174 100644
--- 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;