Commit 048e7f7e authored by Alexander Aring's avatar Alexander Aring Committed by Marcel Holtmann

ieee802154: cleanup WARN_ON for fc fetch

This patch cleanups the WARN_ON which occurs when the sk buffer has
insufficient buffer space by moving the WARN_ON into if condition.
Signed-off-by: default avatarAlexander Aring <aar@pengutronix.de>
Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
parent 38961294
...@@ -250,11 +250,10 @@ static inline __le16 ieee802154_get_fc_from_skb(const struct sk_buff *skb) ...@@ -250,11 +250,10 @@ static inline __le16 ieee802154_get_fc_from_skb(const struct sk_buff *skb)
__le16 fc; __le16 fc;
/* check if we can fc at skb_mac_header of sk buffer */ /* check if we can fc at skb_mac_header of sk buffer */
if (unlikely(!skb_mac_header_was_set(skb) || if (WARN_ON(!skb_mac_header_was_set(skb) ||
(skb_tail_pointer(skb) - skb_mac_header(skb)) < 2)) { (skb_tail_pointer(skb) -
WARN_ON(1); skb_mac_header(skb)) < IEEE802154_FC_LEN))
return cpu_to_le16(0); return cpu_to_le16(0);
}
memcpy(&fc, skb_mac_header(skb), IEEE802154_FC_LEN); memcpy(&fc, skb_mac_header(skb), IEEE802154_FC_LEN);
return fc; return fc;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment