diff options
author | Thomas Gleixner <tglx@linutronix.de> | 2023-10-17 22:40:46 +0300 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2023-10-17 22:40:46 +0300 |
commit | a940daa52167e9db8ecce82213813b735a9d9f23 (patch) | |
tree | d5346c51351ccd1da7532cbec3127e6b73ec59c9 /lib/string_helpers.c | |
parent | 32e4fa37fa667fdf53499b9de92737dc75199d8e (diff) | |
parent | 58720809f52779dc0f08e53e54b014209d13eebb (diff) | |
download | linux-a940daa52167e9db8ecce82213813b735a9d9f23.tar.xz |
Merge branch 'linus' into smp/core
Pull in upstream to get the fixes so depending changes can be applied.
Diffstat (limited to 'lib/string_helpers.c')
-rw-r--r-- | lib/string_helpers.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/string_helpers.c b/lib/string_helpers.c index d3b1dd718daf..9982344cca34 100644 --- a/lib/string_helpers.c +++ b/lib/string_helpers.c @@ -719,6 +719,21 @@ char *kstrdup_quotable_file(struct file *file, gfp_t gfp) } EXPORT_SYMBOL_GPL(kstrdup_quotable_file); +/* + * Returns duplicate string in which the @old characters are replaced by @new. + */ +char *kstrdup_and_replace(const char *src, char old, char new, gfp_t gfp) +{ + char *dst; + + dst = kstrdup(src, gfp); + if (!dst) + return NULL; + + return strreplace(dst, old, new); +} +EXPORT_SYMBOL_GPL(kstrdup_and_replace); + /** * kasprintf_strarray - allocate and fill array of sequential strings * @gfp: flags for the slab allocator |