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 <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
This commit is contained in:
Andy Shevchenko 2023-06-05 20:05:53 +03:00 committed by Kees Cook
parent d01a77afd6
commit b2f10148ec

View File

@ -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;