From: Stefan Schmidt <stefan@osg.samsung.com>
To: Alexander Aring <aar@pengutronix.de>, linux-wpan@vger.kernel.org
Cc: kernel@pengutronix.de
Subject: Re: [PATCH bluetooth-next] ieee802154: fix skb get fc on big endian
Date: Wed, 22 Jun 2016 16:26:43 +0200 [thread overview]
Message-ID: <576AA023.5080307@osg.samsung.com> (raw)
In-Reply-To: <20160618083607.3538-1-aar@pengutronix.de>
Hello.
On 18/06/16 10:36, Alexander Aring wrote:
> This patch fixes ieee802154_get_fc_from_skb function on big endian
> machines. The function get_unaligned_le16 converts the byte order to
> host byte order but we want to keep the byte order like in mac header.
>
> Signed-off-by: Alexander Aring <aar@pengutronix.de>
> ---
> include/net/mac802154.h | 12 +++++++-----
> 1 file changed, 7 insertions(+), 5 deletions(-)
>
> diff --git a/include/net/mac802154.h b/include/net/mac802154.h
> index df34187..3d7fa73 100644
> --- a/include/net/mac802154.h
> +++ b/include/net/mac802154.h
> @@ -247,14 +247,16 @@ struct ieee802154_ops {
> */
> static inline __le16 ieee802154_get_fc_from_skb(const struct sk_buff *skb)
> {
> + __le16 fc;
> +
> /* check if we can fc at skb_mac_header of sk buffer */
> - if (unlikely(!skb_mac_header_was_set(skb) ||
> - (skb_tail_pointer(skb) - skb_mac_header(skb)) < 2)) {
> - WARN_ON(1);
> + if (WARN_ON(!skb_mac_header_was_set(skb) ||
> + (skb_tail_pointer(skb) -
> + skb_mac_header(skb)) < IEEE802154_FC_LEN))
> return cpu_to_le16(0);
> - }
The hunk above is totally unrelated to the change you describe in your
commit messages and should imho be split off into a different patch.
>
> - return get_unaligned_le16(skb_mac_header(skb));
> + memcpy(&fc, skb_mac_header(skb), IEEE802154_FC_LEN);
> + return fc;
> }
>
> /**
The actual fix for big endian looks fine to me.
regards
Stefan Schmidt
prev parent reply other threads:[~2016-06-22 14:27 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-18 8:36 [PATCH bluetooth-next] ieee802154: fix skb get fc on big endian Alexander Aring
2016-06-22 14:26 ` Stefan Schmidt [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=576AA023.5080307@osg.samsung.com \
--to=stefan@osg.samsung.com \
--cc=aar@pengutronix.de \
--cc=kernel@pengutronix.de \
--cc=linux-wpan@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.