Skip to content

Commit

Permalink
ieee802154: cleanup WARN_ON for fc fetch
Browse files Browse the repository at this point in the history
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: Alexander Aring <aar@pengutronix.de>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
  • Loading branch information
Alexander Aring authored and Marcel Holtmann committed Jul 8, 2016
1 parent 3896129 commit 048e7f7
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions include/net/mac802154.h
Original file line number Diff line number Diff line change
@@ -250,11 +250,10 @@ 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);
}

memcpy(&fc, skb_mac_header(skb), IEEE802154_FC_LEN);
return fc;

0 comments on commit 048e7f7

Please sign in to comment.