diff options
author | Andy Shevchenko <andriy.shevchenko@linux.intel.com> | 2014-10-13 18:55:33 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-10-13 20:18:27 -0400 |
commit | 8a1db92830d0a71e1429725992eb91470214c820 (patch) | |
tree | 920d5affb4f9712d3c8aa0b008a4b8597f45428f /drivers/staging | |
parent | 50d5e53ddfc0d9cf4707d7d8e22624b26ab9114e (diff) |
staging: rtl8192u: 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>
Diffstat (limited to 'drivers/staging')
-rw-r--r-- | drivers/staging/rtl8192u/ieee80211/ieee80211.h | 14 |
1 files changed, 1 insertions, 13 deletions
diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211.h b/drivers/staging/rtl8192u/ieee80211/ieee80211.h index 9ecfa4a2421d..b44aa17d30a7 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211.h +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211.h | |||
@@ -2593,25 +2593,13 @@ static inline int ieee80211_get_scans(struct ieee80211_device *ieee) | |||
2593 | 2593 | ||
2594 | static inline const char *escape_essid(const char *essid, u8 essid_len) { | 2594 | static inline const char *escape_essid(const char *essid, u8 essid_len) { |
2595 | static char escaped[IW_ESSID_MAX_SIZE * 2 + 1]; | 2595 | static char escaped[IW_ESSID_MAX_SIZE * 2 + 1]; |
2596 | const char *s = essid; | ||
2597 | char *d = escaped; | ||
2598 | 2596 | ||
2599 | if (ieee80211_is_empty_essid(essid, essid_len)) { | 2597 | if (ieee80211_is_empty_essid(essid, essid_len)) { |
2600 | memcpy(escaped, "<hidden>", sizeof("<hidden>")); | 2598 | memcpy(escaped, "<hidden>", sizeof("<hidden>")); |
2601 | return escaped; | 2599 | return escaped; |
2602 | } | 2600 | } |
2603 | 2601 | ||
2604 | essid_len = min(essid_len, (u8)IW_ESSID_MAX_SIZE); | 2602 | snprintf(escaped, sizeof(escaped), "%*pEn", essid_len, essid); |
2605 | while (essid_len--) { | ||
2606 | if (*s == '\0') { | ||
2607 | *d++ = '\\'; | ||
2608 | *d++ = '0'; | ||
2609 | s++; | ||
2610 | } else { | ||
2611 | *d++ = *s++; | ||
2612 | } | ||
2613 | } | ||
2614 | *d = '\0'; | ||
2615 | return escaped; | 2603 | return escaped; |
2616 | } | 2604 | } |
2617 | 2605 | ||