linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Adrien Descamps <adrien.descamps@gmail.com>
To: gregkh@linuxfoundation.org
Cc: devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org,
	Adrien Descamps <adrien.descamps@gmail.com>
Subject: [PATCH 2/2] Staging: wlan-ng: Fix endian error
Date: Fri,  3 Mar 2017 19:58:31 +0100	[thread overview]
Message-ID: <1488567511-3284-2-git-send-email-adrien.descamps@gmail.com> (raw)
In-Reply-To: <1488567511-3284-1-git-send-email-adrien.descamps@gmail.com>

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

  reply	other threads:[~2017-03-03 19:00 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-02 20:30 [PATCH 1/2] Fix sparse warnings by using appropriate endian types Adrien Descamps
2017-03-02 20:30 ` [PATCH 2/2] Fix endiannes error Adrien Descamps
2017-03-03 11:29   ` Dan Carpenter
2017-03-03 18:58     ` [PATCH 1/2] Staging: wlan-ng: Fix sparse warnings by using appropriate endian types Adrien Descamps
2017-03-03 18:58       ` Adrien Descamps [this message]
2017-03-09 18:05       ` Greg KH
2017-03-09 20:15         ` Adrien Descamps
2017-03-09 20:15           ` [PATCH 2/2] Staging: wlan-ng: Fix endian error Adrien Descamps

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1488567511-3284-2-git-send-email-adrien.descamps@gmail.com \
    --to=adrien.descamps@gmail.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).