From: Harvey Harrison <harvey.harrison@gmail.com>
To: linux-wireless@vger.kernel.org,
Shaddy Baddah <shaddy_baddah@hotmail.com>
Cc: Sebastian Andrzej Siewior <sebastian@breakpoint.cc>
Subject: Re: zd1211rw (2.6.26 sparc64): unaligned access (zd_mac_rx)
Date: Thu, 27 Nov 2008 22:47:16 -0800 [thread overview]
Message-ID: <1227854836.5880.8.camel@brick> (raw)
In-Reply-To: <492F856D.9020200@hotmail.com>
On Fri, 2008-11-28 at 16:45 +1100, Shaddy Baddah wrote:
> On 25/10/08 22:28, Sebastian Andrzej Siewior wrote:
> > Subject: [PATCH] wireless/zd1211rw: use get_unaligned_le16 helper (v2)
>
> I'm not too sure about the protocol for updating a patch to claim that
> you've verified it, but I hope to get this patch applied to git by
> verifying it worked for me on an sparc64 machine.
>
> Subject: [PATCH] wireless/zd1211rw: use get_unaligned_le16 helper (v2)
>
> Signed-off-by: Sebastian Andrzej Siewior <sebastian@breakpoint.cc>
> Tested-by: Shaddy Baddah <shaddy_badddah@hotmail.com>
> ---
> drivers/net/wireless/zd1211rw/zd_mac.c | 5 +++--
> drivers/net/wireless/zd1211rw/zd_usb.c | 2 +-
> 2 files changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/net/wireless/zd1211rw/zd_mac.c
> b/drivers/net/wireless/zd1211rw/zd_mac.c
> index 4d7b98b..bf4b4a4 100644
> --- a/drivers/net/wireless/zd1211rw/zd_mac.c
> +++ b/drivers/net/wireless/zd1211rw/zd_mac.c
> @@ -25,6 +25,7 @@
> #include <linux/usb.h>
> #include <linux/jiffies.h>
> #include <net/ieee80211_radiotap.h>
> +#include <asm/unaligned.h>
>
> #include "zd_def.h"
> #include "zd_chip.h"
> @@ -662,7 +663,7 @@ int zd_mac_rx(struct ieee80211_hw *hw, const u8
> *buffer, unsigned int length)
> && !mac->pass_ctrl)
> return 0;
>
> - fc = *(__le16 *)buffer;
> + fc = get_unaligned_le16(buffer);
> need_padding = ieee80211_is_data_qos(fc) ^ ieee80211_has_a4(fc);
>
I think this should be:
fc = get_unaligned((__le16 *)buffer);
As ieee8011_is_data_qos wants a le16 and your use above will swap to cpu-order.
>
> skb = dev_alloc_skb(length + (need_padding ? 2 : 0));
> @@ -758,7 +759,7 @@ void zd_process_intr(struct work_struct *work)
> u16 int_status;
> struct zd_mac *mac = container_of(work, struct zd_mac, process_intr);
>
> - int_status = le16_to_cpu(*(__le16 *)(mac->intr_buffer+4));
> + int_status = get_unaligned_le16(mac->intr_buffer+4);
OK.
> if (int_status & INT_CFG_NEXT_BCN) {
> if (net_ratelimit())
> dev_dbg_f(zd_mac_dev(mac), "INT_CFG_NEXT_BCN\n");
> diff --git a/drivers/net/wireless/zd1211rw/zd_usb.c
> b/drivers/net/wireless/zd1211rw/zd_usb.c
> index a60ae86..0b27778 100644
> --- a/drivers/net/wireless/zd1211rw/zd_usb.c
> +++ b/drivers/net/wireless/zd1211rw/zd_usb.c
> @@ -355,7 +355,7 @@ static inline void handle_regs_int(struct urb *urb)
> ZD_ASSERT(in_interrupt());
> spin_lock(&intr->lock);
>
> - int_num = le16_to_cpu(*(__le16 *)(urb->transfer_buffer+2));
> + int_num = get_unaligned_le16(urb->transfer_buffer+2);
> if (int_num == CR_INTERRUPT) {
> struct zd_mac *mac = zd_hw_mac(zd_usb_to_hw(urb->context));
> memcpy(&mac->intr_buffer, urb->transfer_buffer,
OK.
So the first hunk needs changing, but other than that, looks OK.
Harvey
prev parent reply other threads:[~2008-11-28 6:47 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-10-25 8:54 zd1211rw (2.6.26 sparc64): unaligned access (zd_mac_rx) Shaddy Baddah
2008-10-25 9:17 ` Johannes Berg
2008-10-25 11:25 ` Sebastian Andrzej Siewior
2008-10-25 12:05 ` Johannes Berg
2008-10-26 22:00 ` Sebastian Andrzej Siewior
2008-10-27 7:00 ` Johannes Berg
2008-10-25 11:21 ` Sebastian Andrzej Siewior
2008-10-25 11:25 ` Michael Buesch
2008-10-25 11:28 ` Sebastian Andrzej Siewior
2008-10-25 11:31 ` Michael Buesch
2008-10-25 11:38 ` Sebastian Andrzej Siewior
2008-10-25 15:13 ` Shaddy Baddah
[not found] ` <491589ED.4090904@hotmail.com>
2008-11-08 12:45 ` Shaddy Baddah
2008-11-08 13:11 ` Johannes Berg
[not found] ` <491653A6.20705@hotmail.com>
2008-11-09 3:06 ` Shaddy Baddah
[not found] ` <49165436.4040306@hotmail.com>
2008-11-09 3:08 ` Shaddy Baddah
2008-11-09 12:00 ` Michael Buesch
2008-11-09 8:56 ` Johannes Berg
2008-11-09 9:03 ` Johannes Berg
2008-11-09 12:02 ` Michael Buesch
2008-11-09 18:31 ` Johannes Berg
[not found] ` <4916F1C0.1040703@hotmail.com>
2008-11-09 14:20 ` Shaddy Baddah
[not found] ` <49184F82.9070102@hotmail.com>
2008-11-10 15:13 ` Shaddy Baddah
[not found] ` <492F82EA.4030902@hotmail.com>
2008-11-28 5:34 ` Shaddy Baddah
2008-11-28 7:10 ` David Miller
2008-11-28 22:44 ` Michael Buesch
[not found] ` <49310454.60906@hotmail.com>
2008-11-29 8:59 ` Shaddy Baddah
2008-11-29 9:50 ` Johannes Berg
[not found] ` <49313C0E.9030309@hotmail.com>
2008-11-29 12:56 ` Shaddy Baddah
[not found] ` <492F856D.9020200@hotmail.com>
2008-11-28 5:45 ` Shaddy Baddah
2008-11-28 6:47 ` Harvey Harrison [this message]
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=1227854836.5880.8.camel@brick \
--to=harvey.harrison@gmail.com \
--cc=linux-wireless@vger.kernel.org \
--cc=sebastian@breakpoint.cc \
--cc=shaddy_baddah@hotmail.com \
/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).