Re: [PATCH v3 1/6] string_helpers: add kstrdup_quotable

From: Joe Perches
Date: Thu Apr 07 2016 - 04:06:22 EST


On Wed, 2016-04-06 at 17:20 -0700, Kees Cook wrote:
> Handle allocating and escaping a string safe for logging.

trivia: should add const

> diff --git a/include/linux/string_helpers.h b/include/linux/string_helpers.h
[]
> @@ -68,4 +68,6 @@ static inline int string_escape_str_any_np(const char *src, char *dst,
>   return string_escape_str(src, dst, sz, ESCAPE_ANY_NP, only);
>  }
>  
> +char *kstrdup_quotable(char *src, gfp_t gfp);

char *kstrdup_quotable(const char *src, gfp_t gfp);