Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp1988290imm; Thu, 24 May 2018 04:06:18 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpx4vGHhcKuh7Vh+b6R8e1ssqC34PhANno+vzIQ5sWLzCZ5pMuYhB+qh3wJDMdKXRkaFWz1 X-Received: by 2002:a62:a315:: with SMTP id s21-v6mr6846721pfe.168.1527159978036; Thu, 24 May 2018 04:06:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527159978; cv=none; d=google.com; s=arc-20160816; b=oAR97LMwY05cO+XObL+0NlHDgrrAMyj/nqDH5f5zymHVKMrLBnnYHr1QoGgVZbPjMI /NzXL0M/3si3xj+620s6pc+DBwoHZZpFzAIVls3xX3HeZBUOUzRlYob7eLf/7b/OBDaj iOTjt4bm3M+R2kCUYfflO6AhClDs2KStZD4R5Z3/T030s3ikORVmGMayli7BXgMZPgrx i+g/ZDcsV3heRx2BId/FnKpQhNQ/8p8KvANn+y/pQoqS+ddl7tMfDmwCfAXegzYKpBbW ez29JMv036ZToj1z7MHyNr58FwH9hA1DpWG5HinjrTJ1Po7NcHVQ3uzF5oqcWCgU25GS uHxg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=ZDAh/D6V/sUBuWjACXJH/J0BvsCs0TAJ0r1XHNrE5EQ=; b=blxbpwbCt/LmzhHd1FmQ62JPXdLdj3qdQAMnhMIzxX6WhTD8FIh10Lpvn8OJME+oZs 7DWOKn1hwoiO5+lVRxKj/H7jfQxYEcqtRvLUBfDLQmB0fkfWikvMHGfasl7YQAwYmmm/ ulGhJW3MFq1dk992fTnNL5glakc6KBXPsUh3hoo7ERJPgf0go4GL/+dMoGy110x6KrL5 /s3v2NZzLNSusLtY5c4cl4Xf+TWafjE9S11XlTd9hr2O9MQ2ZsQzzcM3RCoHJYDroNUL tnJ672ExS407G9U2Cs+5yQaMMoNvV2a2uLMpnWRTRNFhINFOqpioj93cCcl7NligUijq AqdA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=XsK/8SMb; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z10-v6si16146260pgz.443.2018.05.24.04.06.03; Thu, 24 May 2018 04:06:17 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=XsK/8SMb; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S968318AbeEXJzR (ORCPT + 99 others); Thu, 24 May 2018 05:55:17 -0400 Received: from mail.kernel.org ([198.145.29.99]:35296 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S968296AbeEXJzL (ORCPT ); Thu, 24 May 2018 05:55:11 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 8C0D120892; Thu, 24 May 2018 09:55:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1527155710; bh=tIKByd/uWcOHvwymhNetyA97tHWRgp/uA2A76vVVoB8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XsK/8SMbZXkTDAMn+3bqOzv14S6YYgq6nz95NRrwU0peXjGDIBCRnxDL731Lw5Ib5 z7nDtWPEw2fLOfdS56xV+1Hs2yhpvE3jp4mMxFxTQxQYcdXgZ4tt9p2wrLfU7wm9Qt K5/IbVW4btrPU/9aNawlLt3io2lffwZQgeb/XJ+0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Quytelda Kahja , "Tobin C. Harding" , Sasha Levin Subject: [PATCH 4.14 089/165] staging: ks7010: Use constants from ieee80211_eid instead of literal ints. Date: Thu, 24 May 2018 11:38:15 +0200 Message-Id: <20180524093625.629864043@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180524093621.979359379@linuxfoundation.org> References: <20180524093621.979359379@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Quytelda Kahja [ Upstream commit dc13498ab47fdfae3cda4df712beb2e4244b3fe0 ] The case statement in get_ap_information() should not use literal integers to parse information element IDs when these values are provided by name in 'enum ieee80211_eid' in the header 'linux/ieee80211.h'. Signed-off-by: Quytelda Kahja Reviewed-by: Tobin C. Harding Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/staging/ks7010/ks_hostif.c | 31 +++++++++++++++---------------- drivers/staging/ks7010/ks_hostif.h | 1 + 2 files changed, 16 insertions(+), 16 deletions(-) --- a/drivers/staging/ks7010/ks_hostif.c +++ b/drivers/staging/ks7010/ks_hostif.c @@ -242,9 +242,8 @@ int get_ap_information(struct ks_wlan_pr offset = 0; while (bsize > offset) { - /* DPRINTK(4, "Element ID=%d\n",*bp); */ - switch (*bp) { - case 0: /* ssid */ + switch (*bp) { /* Information Element ID */ + case WLAN_EID_SSID: if (*(bp + 1) <= SSID_MAX_SIZE) { ap->ssid.size = *(bp + 1); } else { @@ -254,8 +253,8 @@ int get_ap_information(struct ks_wlan_pr } memcpy(ap->ssid.body, bp + 2, ap->ssid.size); break; - case 1: /* rate */ - case 50: /* ext rate */ + case WLAN_EID_SUPP_RATES: + case WLAN_EID_EXT_SUPP_RATES: if ((*(bp + 1) + ap->rate_set.size) <= RATE_SET_MAX_SIZE) { memcpy(&ap->rate_set.body[ap->rate_set.size], @@ -271,9 +270,9 @@ int get_ap_information(struct ks_wlan_pr (RATE_SET_MAX_SIZE - ap->rate_set.size); } break; - case 3: /* DS parameter */ + case WLAN_EID_DS_PARAMS: break; - case 48: /* RSN(WPA2) */ + case WLAN_EID_RSN: ap->rsn_ie.id = *bp; if (*(bp + 1) <= RSN_IE_BODY_MAX) { ap->rsn_ie.size = *(bp + 1); @@ -284,8 +283,8 @@ int get_ap_information(struct ks_wlan_pr } memcpy(ap->rsn_ie.body, bp + 2, ap->rsn_ie.size); break; - case 221: /* WPA */ - if (memcmp(bp + 2, "\x00\x50\xf2\x01", 4) == 0) { /* WPA OUI check */ + case WLAN_EID_VENDOR_SPECIFIC: /* WPA */ + if (memcmp(bp + 2, "\x00\x50\xf2\x01", 4) == 0) { /* WPA OUI check */ ap->wpa_ie.id = *bp; if (*(bp + 1) <= RSN_IE_BODY_MAX) { ap->wpa_ie.size = *(bp + 1); @@ -300,18 +299,18 @@ int get_ap_information(struct ks_wlan_pr } break; - case 2: /* FH parameter */ - case 4: /* CF parameter */ - case 5: /* TIM */ - case 6: /* IBSS parameter */ - case 7: /* Country */ - case 42: /* ERP information */ - case 47: /* Reserve ID 47 Broadcom AP */ + case WLAN_EID_FH_PARAMS: + case WLAN_EID_CF_PARAMS: + case WLAN_EID_TIM: + case WLAN_EID_IBSS_PARAMS: + case WLAN_EID_COUNTRY: + case WLAN_EID_ERP_INFO: break; default: DPRINTK(4, "unknown Element ID=%d\n", *bp); break; } + offset += 2; /* id & size field */ offset += *(bp + 1); /* +size offset */ bp += (*(bp + 1) + 2); /* pointer update */ --- a/drivers/staging/ks7010/ks_hostif.h +++ b/drivers/staging/ks7010/ks_hostif.h @@ -13,6 +13,7 @@ #define _KS_HOSTIF_H_ #include +#include /* * HOST-MAC I/F events