From patchwork Wed Aug 20 09:42:49 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 4748351 Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 62A7FC0338 for ; Wed, 20 Aug 2014 09:44:18 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 96F0D2017A for ; Wed, 20 Aug 2014 09:44:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B24C52018A for ; Wed, 20 Aug 2014 09:44:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751945AbaHTJne (ORCPT ); Wed, 20 Aug 2014 05:43:34 -0400 Received: from mga02.intel.com ([134.134.136.20]:37021 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752129AbaHTJnD (ORCPT ); Wed, 20 Aug 2014 05:43:03 -0400 Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga101.jf.intel.com with ESMTP; 20 Aug 2014 02:43:01 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.01,901,1400050800"; d="scan'208";a="590683064" Received: from smile.fi.intel.com (HELO smile) ([10.237.72.77]) by orsmga002.jf.intel.com with ESMTP; 20 Aug 2014 02:42:54 -0700 Received: from andy by smile with local (Exim 4.84) (envelope-from ) id 1XK2Pt-00076Z-0E; Wed, 20 Aug 2014 12:42:53 +0300 From: Andy Shevchenko To: "John W . Linville" , Johannes Berg , devel@driverdev.osuosl.org, linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org, Greg Kroah-Hartman , Andrew Morton , Joe Perches Cc: Andy Shevchenko Subject: [PATCH v3 08/11] lib80211: remove unused print_ssid() Date: Wed, 20 Aug 2014 12:42:49 +0300 Message-Id: <1408527772-27224-9-git-send-email-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1408527772-27224-1-git-send-email-andriy.shevchenko@linux.intel.com> References: <1408527772-27224-1-git-send-email-andriy.shevchenko@linux.intel.com> Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP In kernel we have %*pE specifier to print an escaped buffer. All users now switched to that approach. This fixes a bug as well. The current implementation wrongly prints octal numbers: only two first digits are used in case when 3 are required and the rest of the string ends up cut off. Additionally by default the \f, \v, \a, and \e are escaped to their alphabetic representation. It's safe to do since it is currently used for messaging only. Signed-off-by: Andy Shevchenko --- include/net/lib80211.h | 5 ----- net/wireless/lib80211.c | 32 -------------------------------- 2 files changed, 37 deletions(-) diff --git a/include/net/lib80211.h b/include/net/lib80211.h index be95b92..aab0f42 100644 --- a/include/net/lib80211.h +++ b/include/net/lib80211.h @@ -32,11 +32,6 @@ #include #include -/* print_ssid() is intended to be used in debug (and possibly error) - * messages. It should never be used for passing ssid to user space. */ -const char *print_ssid(char *buf, const char *ssid, u8 ssid_len); -#define DECLARE_SSID_BUF(var) char var[IEEE80211_MAX_SSID_LEN * 4 + 1] __maybe_unused - #define NUM_WEP_KEYS 4 enum { diff --git a/net/wireless/lib80211.c b/net/wireless/lib80211.c index a55c27b..4596115 100644 --- a/net/wireless/lib80211.c +++ b/net/wireless/lib80211.c @@ -46,38 +46,6 @@ static void lib80211_crypt_deinit_entries(struct lib80211_crypt_info *info, static void lib80211_crypt_quiescing(struct lib80211_crypt_info *info); static void lib80211_crypt_deinit_handler(unsigned long data); -const char *print_ssid(char *buf, const char *ssid, u8 ssid_len) -{ - const char *s = ssid; - char *d = buf; - - ssid_len = min_t(u8, ssid_len, IEEE80211_MAX_SSID_LEN); - while (ssid_len--) { - if (isprint(*s)) { - *d++ = *s++; - continue; - } - - *d++ = '\\'; - if (*s == '\0') - *d++ = '0'; - else if (*s == '\n') - *d++ = 'n'; - else if (*s == '\r') - *d++ = 'r'; - else if (*s == '\t') - *d++ = 't'; - else if (*s == '\\') - *d++ = '\\'; - else - d += snprintf(d, 3, "%03o", *s); - s++; - } - *d = '\0'; - return buf; -} -EXPORT_SYMBOL(print_ssid); - int lib80211_crypt_info_init(struct lib80211_crypt_info *info, char *name, spinlock_t *lock) {