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


Groups > linux.kernel > #1592226

[PATCH 2/2] Staging: wlan-ng: Fix endian error

From Adrien Descamps <adrien.descamps@gmail.com>
Newsgroups linux.kernel
Subject [PATCH 2/2] Staging: wlan-ng: Fix endian error
Date 2017-03-03 20:10 +0100
Message-ID <th0Ku-5zM-7@gated-at.bofh.it> (permalink)
References <tgYfE-3Kq-25@gated-at.bofh.it> <th0Ku-5zM-1@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


sparse report fixed:
drivers/staging//wlan-ng//hfa384x_usb.c:3517:35: warning: restricted __be64 degrades to integer
drivers/staging//wlan-ng//hfa384x_usb.c:3517:33: warning: incorrect type in assignment (different base types)
drivers/staging//wlan-ng//hfa384x_usb.c:3517:33:    expected restricted __be64 [usertype] mactime
drivers/staging//wlan-ng//hfa384x_usb.c:3517:33:    got unsigned long long

Computation on the value should be done when in machine format, not in big endian format.

Signed-off-by: Adrien Descamps <adrien.descamps@gmail.com>
---
Compile tested only
 drivers/staging/wlan-ng/hfa384x_usb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/wlan-ng/hfa384x_usb.c b/drivers/staging/wlan-ng/hfa384x_usb.c
index f26cc19..29b059f 100644
--- a/drivers/staging/wlan-ng/hfa384x_usb.c
+++ b/drivers/staging/wlan-ng/hfa384x_usb.c
@@ -3514,7 +3514,7 @@ static void hfa384x_int_rxmonitor(struct wlandevice *wlandev,
 
 		caphdr->version = htonl(P80211CAPTURE_VERSION);
 		caphdr->length = htonl(sizeof(struct p80211_caphdr));
-		caphdr->mactime = __cpu_to_be64(rxdesc->time) * 1000;
+		caphdr->mactime = __cpu_to_be64(rxdesc->time * 1000);
 		caphdr->hosttime = __cpu_to_be64(jiffies);
 		caphdr->phytype = htonl(4);	/* dss_dot11_b */
 		caphdr->channel = htonl(hw->sniff_channel);
-- 
2.1.4

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


Thread

[PATCH 1/2] Fix sparse warnings by using appropriate endian types Adrien Descamps <adrien.descamps@gmail.com> - 2017-03-02 21:40 +0100
  [PATCH 2/2] Fix endiannes error Adrien Descamps <adrien.descamps@gmail.com> - 2017-03-02 21:40 +0100
    Re: [PATCH 2/2] Fix endiannes error Dan Carpenter <dan.carpenter@oracle.com> - 2017-03-03 17:30 +0100
      [PATCH 1/2] Staging: wlan-ng: Fix sparse warnings by using appropriate endian types Adrien Descamps <adrien.descamps@gmail.com> - 2017-03-03 20:10 +0100
        [PATCH 2/2] Staging: wlan-ng: Fix endian error Adrien Descamps <adrien.descamps@gmail.com> - 2017-03-03 20:10 +0100
        Re: [PATCH 1/2] Staging: wlan-ng: Fix sparse warnings by using  appropriate endian types Greg KH <gregkh@linuxfoundation.org> - 2017-03-09 19:10 +0100
          [PATCH 2/2] Staging: wlan-ng: Fix endian error Adrien Descamps <adrien.descamps@gmail.com> - 2017-03-09 21:20 +0100
          [PATCH 1/2] Staging: wlan-ng: Fix sparse warnings by using appropriate endian types Adrien Descamps <adrien.descamps@gmail.com> - 2017-03-09 21:20 +0100

csiph-web