Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1159984

[PATCH v2 1/2] staging: rtl8723au: core: avoid bitwise arithmetic with forced endianness

Path csiph.com!aioe.org!eternal-september.org!feeder.eternal-september.org!feeds.phibee-telecom.net!news.panservice.it!diesel.cu.mi.it!bofh.it!news.nic.it!robomod
From David Decotigny <ddecotig@gmail.com>
Newsgroups linux.kernel
Subject [PATCH v2 1/2] staging: rtl8723au: core: avoid bitwise arithmetic with forced endianness
Date Sun, 07 Jun 2015 03:00:02 +0200
Message-ID <pyx6q-aG-3@gated-at.bofh.it> (permalink)
References <pywN4-8f6-3@gated-at.bofh.it>
X-Original-To Oleg Drokin <oleg.drokin@intel.com>, Andreas Dilger <andreas.dilger@intel.com>, Greg Kroah-Hartman <gregkh@linuxfoundation.org>, HPDD-discuss@lists.01.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org
Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=XHvPiZrra53qcAWoVnWnQKrTwwUhpxc1Zhf7XnUwSnQ=; b=OLsrZhi0nyZ2r70/SoqbpVmH5m7IHGcndHAw2klAbyv3jfoA6MVgH2qEyZcev6/RZN xBHWImPI3+rEvVc2rHLtOmkImt34CVH0Lqf+TOIvfSWGGEagQsDDrk4kNVZBEAWE24v/ jTZ3w6XEAF7SWEePHfqvHfuEcBRk1sv06C0R89o0mZRV0QGNk47p5v+XU/jOAIfOVFns NC5Y/tLgDhi+bB4CisUYzOMhuwelEKcbvy1ktAP+8qgors49PffMbcYXVvrKC+rkNtih en1MAlwx4HQSc4l5kKuaNAMNGy4V9y5MUkQnPTHMgndJMClkzzXV4aZ47m87iLWppP+0 lC/A==
X-Received by 10.55.25.42 with SMTP id k42mr19653344qkh.79.1433637260783; Sat, 06 Jun 2015 17:34:20 -0700 (PDT)
X-Mailer git-send-email 2.2.0.rc0.207.ga3a616c
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 40
Organization linux.* mail to news gateway
X-Original-Cc Doug Oucharek <doug.s.oucharek@intel.com>, Peng Tao <bergwolf@gmail.com>, Isaac Huang <he.huang@intel.com>, Amir Shehata <amir.shehata@intel.com>, David Decotigny <ddecotig@gmail.com>, Liang Zhen <liang.zhen@intel.com>
X-Original-Date Sat, 6 Jun 2015 17:33:59 -0700
X-Original-Message-ID <1433637240-24223-2-git-send-email-ddecotig@gmail.com>
X-Original-References <1433637240-24223-1-git-send-email-ddecotig@gmail.com>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref aioe.org linux.kernel:1159984

Show key headers only | View raw


This fixes bitwise arithmetic performed on the host on a variable
previously converted to little-endian, and subsequently converted
again to little-endian:
  - issue_action_BA23a() called with "status" crafted in host byte order
  - "status" converted to LE
  - bitwise arithmetic on the (LE) "status", performed with masks and
    shifts in host byte order
  - result converted to LE (again) and stored in device structure

Sparse warning addressed by this patch:
  drivers/staging/rtl8723au/core/rtw_mlme_ext.c:3806:16: warning: incorrect type in assignment (different base types)
  drivers/staging/rtl8723au/core/rtw_mlme_ext.c:3806:16:    expected unsigned short [unsigned] status
  drivers/staging/rtl8723au/core/rtw_mlme_ext.c:3806:16:    got restricted __le16 [usertype] <noident>

Signed-off-by: David Decotigny <ddecotig@gmail.com>
---
 drivers/staging/rtl8723au/core/rtw_mlme_ext.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/staging/rtl8723au/core/rtw_mlme_ext.c b/drivers/staging/rtl8723au/core/rtw_mlme_ext.c
index 196beaf..7c3b5dd 100644
--- a/drivers/staging/rtl8723au/core/rtw_mlme_ext.c
+++ b/drivers/staging/rtl8723au/core/rtw_mlme_ext.c
@@ -3803,8 +3803,6 @@ void issue_action_BA23a(struct rtw_adapter *padapter,
 
 	pattrib->pktlen = sizeof(struct ieee80211_hdr_3addr) + 1;
 
-	status = cpu_to_le16(status);
-
 	switch (action) {
 	case WLAN_ACTION_ADDBA_REQ:
 		pattrib->pktlen += sizeof(mgmt->u.action.u.addba_req);
-- 
2.2.0.rc0.207.ga3a616c

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v2 0/2] staging: rtl8723au: core: endianness issues David Decotigny <ddecotig@gmail.com> - 2015-06-07 02:40 +0200
  [PATCH v2 2/2] staging: rtl8723au: core: remove redundant endianness conversion David Decotigny <ddecotig@gmail.com> - 2015-06-07 02:40 +0200
  [PATCH v2 1/2] staging: rtl8723au: core: avoid bitwise arithmetic with forced endianness David Decotigny <ddecotig@gmail.com> - 2015-06-07 03:00 +0200
    Re: [PATCH v2 1/2] staging: rtl8723au: core: avoid bitwise arithmetic  with forced endianness David Decotigny <ddecotig@gmail.com> - 2015-06-08 02:40 +0200

csiph-web