Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp1945053imm; Thu, 24 May 2018 03:22:43 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpykBi8CSgiUnByP4DQOesYIT7JW6Ge0pBM5fHATX37nNWRfwn9E3dTJnSNhF6We2gq1ij2 X-Received: by 2002:a65:4003:: with SMTP id f3-v6mr5425606pgp.130.1527157363620; Thu, 24 May 2018 03:22:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527157363; cv=none; d=google.com; s=arc-20160816; b=LwBPxNXVi2v581QeRoajbeNemh3LbpVOIzql/s5Zw3IHEqT95DNqsQV7Ojy2q4Tasc EueQlKyqtsTJChG0oqSvr309LkE1nFXr7idERTLC6D5nDIggrc2codODrAhNvmSlPznr xBo8/P2WpEw8VOKkHchwzY4Vi7MnguqgHbiVYuH/Tk+KmooYqbjArFv/zBc6m3qU37y+ Z8ckbgEStohl4U9m9TGURutFUyCvkOIjLYmtoHm9Og0VTErcS3/ZpBSbkP9FTzzfHBSE 2+7tsg/5WIVSmxI+i6NX6sgUOq23oEMVlXbA//WoYs5vNsYCaVfegMjh7i+5UXFkDy4L qMsA== 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=hLQRJ1KpYG21WnTdOaPbH1NNK8KnkwMswXuSgsicr5E=; b=IDlecHCRMaD8N6GcmXKUXZV75w69z23KoiXsz+i9pwyYJVOUQsGtSGkwVFirPn9/zq PgukjffsR4r/Pv3UrrA/J71+OFp4xwJDGlGwGf9FGyR/yjK81iCPrSzY0JGiNbrvXbF6 0AJXXxA6KRFfSdRNuICEOktWiPkRRk6trsOv6baCdoIFt+qWEKB+WvGG1sU9YZlCve2Z 1/tns9BLTEgh0b1uVYTMnDH8almvzk73zPNkVWAGcXBgpmQIBgj2pG3JhkXhLWkFTBJ/ eTn1TYGzKRuR7wcgi9q5QWKF54f2hQEBsq5VhGQodQNXalHqPFg25g9T6CfwLvYdvVam +IRw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=LYKX2rO5; 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 u7-v6si21379006plq.160.2018.05.24.03.22.29; Thu, 24 May 2018 03:22:43 -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=LYKX2rO5; 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 S1031249AbeEXKDR (ORCPT + 99 others); Thu, 24 May 2018 06:03:17 -0400 Received: from mail.kernel.org ([198.145.29.99]:51654 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1030918AbeEXKDK (ORCPT ); Thu, 24 May 2018 06:03:10 -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 93CA820847; Thu, 24 May 2018 10:03:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1527156190; bh=RVWm3UYcEuJoLVgoPjI1VaYT7hAGSw+5gQxFPgV/xLs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LYKX2rO5xAvbF+AwnhWiUmpvOhSWnHCYGIwkqsiHZNk12fCuNoSJMeDUah6Hf7Nvb b74ckVSSsurjyENPcmpAQkjPuHPbBTC/dWJaAZAdf3fNH29XNaFfzfkpA0jwYKc3xL s93FE2hADfYET0l51+pp242dbEH0RpxvSfbYRY0w= 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.16 095/161] staging: ks7010: Use constants from ieee80211_eid instead of literal ints. Date: Thu, 24 May 2018 11:38:40 +0200 Message-Id: <20180524093029.795278427@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180524093018.331893860@linuxfoundation.org> References: <20180524093018.331893860@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.16-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