aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>2014-10-13 18:55:31 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2014-10-13 20:18:27 -0400
commit50d5e53ddfc0d9cf4707d7d8e22624b26ab9114e (patch)
treea991e972da9e9b41ac27087eb7fef69e6b7eb927
parent068c11dac2a5df02c650b8511e10055c95073d5a (diff)
staging: rtl8192e: use %*pEn to escape buffer
Let's use kernel's native specifier to escape a buffer. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Cc: "John W . Linville" <linville@tuxdriver.com> Cc: Johannes Berg <johannes@sipsolutions.net> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: Joe Perches <joe@perches.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--drivers/staging/rtl8192e/rtllib.h14
1 files changed, 1 insertions, 13 deletions
diff --git a/drivers/staging/rtl8192e/rtllib.h b/drivers/staging/rtl8192e/rtllib.h
index 91d35df286c3..2d82f8993ea1 100644
--- a/drivers/staging/rtl8192e/rtllib.h
+++ b/drivers/staging/rtl8192e/rtllib.h
@@ -2957,25 +2957,13 @@ extern inline int rtllib_get_scans(struct rtllib_device *ieee)
2957static inline const char *escape_essid(const char *essid, u8 essid_len) 2957static inline const char *escape_essid(const char *essid, u8 essid_len)
2958{ 2958{
2959 static char escaped[IW_ESSID_MAX_SIZE * 2 + 1]; 2959 static char escaped[IW_ESSID_MAX_SIZE * 2 + 1];
2960 const char *s = essid;
2961 char *d = escaped;
2962 2960
2963 if (rtllib_is_empty_essid(essid, essid_len)) { 2961 if (rtllib_is_empty_essid(essid, essid_len)) {
2964 memcpy(escaped, "<hidden>", sizeof("<hidden>")); 2962 memcpy(escaped, "<hidden>", sizeof("<hidden>"));
2965 return escaped; 2963 return escaped;
2966 } 2964 }
2967 2965
2968 essid_len = min(essid_len, (u8)IW_ESSID_MAX_SIZE); 2966 snprintf(escaped, sizeof(escaped), "%*pEn", essid_len, essid);
2969 while (essid_len--) {
2970 if (*s == '\0') {
2971 *d++ = '\\';
2972 *d++ = '0';
2973 s++;
2974 } else {
2975 *d++ = *s++;
2976 }
2977 }
2978 *d = '\0';
2979 return escaped; 2967 return escaped;
2980} 2968}
2981 2969