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


Groups > linux.kernel > #1679539 > unrolled thread

[PATCH 0/1] Fix cast to restricted __le16 in ks7010 driver

Started byJanusz Lisiecki <janusz.lisiecki@gmail.com>
First post2017-07-02 19:30 +0200
Last post2017-07-03 06:50 +0200
Articles 3 — 1 participant

Back to article view | Back to linux.kernel


Contents

  [PATCH 0/1] Fix cast to restricted __le16 in ks7010 driver Janusz Lisiecki <janusz.lisiecki@gmail.com> - 2017-07-02 19:30 +0200
    [PATCH 0/1] Fix cast to restricted __le16 in ks7010 driver Janusz Lisiecki <janusz.lisiecki@gmail.com> - 2017-07-03 06:50 +0200
      [PATCH 1/1] staging: ks7010: Fix cast to restricted __le16 in ks_wlan_net.c Janusz Lisiecki <janusz.lisiecki@gmail.com> - 2017-07-03 06:50 +0200

#1679539 — [PATCH 0/1] Fix cast to restricted __le16 in ks7010 driver

FromJanusz Lisiecki <janusz.lisiecki@gmail.com>
Date2017-07-02 19:30 +0200
Subject[PATCH 0/1] Fix cast to restricted __le16 in ks7010 driver
Message-ID<tYQR3-58Q-11@gated-at.bofh.it>
This patch fixes Sparse warining found in ks_wlan_net.c. This seems
to be last of it reported by Sparse for that driver. 

Janusz Lisiecki (1):
  staging: ks7010: Fix warning of cast to restricted __le16 in
    ks_wlan_net.c

 drivers/staging/ks7010/ks_wlan_net.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

-- 
1.9.1

[toc] | [next] | [standalone]


#1679639

FromJanusz Lisiecki <janusz.lisiecki@gmail.com>
Date2017-07-03 06:50 +0200
Message-ID<tZ1t7-4u1-1@gated-at.bofh.it>
In reply to#1679539
This patch fixes Sparse warining found in ks_wlan_net.c. This seems
to be last of it reported by Sparse for that driver.
link_ap_info_t structure field 'capability' has native order and is
used everywhere in the code in such way (i.e get_ap_information,
get_current_ap), so le16_to_cpu() on it is wrong and must be removed.
As this is not HW related structure we are free to choose its byte
order and it is easier just to remove one wrong casting than rework
all other places to treat it as __le16.

Janusz Lisiecki (1):
  staging: ks7010: Fix warning of cast to restricted __le16 in
    ks_wlan_net.c

 drivers/staging/ks7010/ks_wlan_net.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

-- 
1.9.1

[toc] | [prev] | [next] | [standalone]


#1679640 — [PATCH 1/1] staging: ks7010: Fix cast to restricted __le16 in ks_wlan_net.c

FromJanusz Lisiecki <janusz.lisiecki@gmail.com>
Date2017-07-03 06:50 +0200
Subject[PATCH 1/1] staging: ks7010: Fix cast to restricted __le16 in ks_wlan_net.c
Message-ID<tZ1t7-4u1-3@gated-at.bofh.it>
In reply to#1679639
This patch fixes the following Sparse warnings in ks_wlan_net.c:
drivers/staging/ks7010/ks_wlan_net.c:1359:24: warning: cast to restricted __le16
link_ap_info_t structure field 'capability' has native order and is used everywhere
in the code in such way (i.e get_ap_information, get_current_ap). Both sides of
assignment are u16 (native order) so 'le16_to_cpu' is not needed and wrong.

Signed-off-by: Janusz Lisiecki <janusz.lisiecki@gmail.com>
---
 drivers/staging/ks7010/ks_wlan_net.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/ks7010/ks_wlan_net.c b/drivers/staging/ks7010/ks_wlan_net.c
index 0c778aa..9a7fbe2 100644
--- a/drivers/staging/ks7010/ks_wlan_net.c
+++ b/drivers/staging/ks7010/ks_wlan_net.c
@@ -1356,7 +1356,7 @@ static inline char *ks_wlan_translate_scan(struct net_device *dev,
 
 	/* Add mode */
 	iwe.cmd = SIOCGIWMODE;
-	capabilities = le16_to_cpu(ap->capability);
+	capabilities = ap->capability;
 	if (capabilities & (BSS_CAP_ESS | BSS_CAP_IBSS)) {
 		if (capabilities & BSS_CAP_ESS)
 			iwe.u.mode = IW_MODE_INFRA;
-- 
1.9.1

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web