aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Aring <aar@pengutronix.de>2016-07-06 17:32:30 -0400
committerMarcel Holtmann <marcel@holtmann.org>2016-07-08 07:23:12 -0400
commit048e7f7e66a8693fe1707997bffd19d08cde08f5 (patch)
treee2a0aa89cba64dc71f3c7363a56ba2dae6137624
parent38961294510ab20d24809c125c0a3738a02d3a28 (diff)
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: Alexander Aring <aar@pengutronix.de> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
-rw-r--r--include/net/mac802154.h7
1 files changed, 3 insertions, 4 deletions
diff --git a/include/net/mac802154.h b/include/net/mac802154.h
index bb7bfecc5ab3..286824acd008 100644
--- a/include/net/mac802154.h
+++ b/include/net/mac802154.h
@@ -250,11 +250,10 @@ static inline __le16 ieee802154_get_fc_from_skb(const struct sk_buff *skb)
250 __le16 fc; 250 __le16 fc;
251 251
252 /* check if we can fc at skb_mac_header of sk buffer */ 252 /* check if we can fc at skb_mac_header of sk buffer */
253 if (unlikely(!skb_mac_header_was_set(skb) || 253 if (WARN_ON(!skb_mac_header_was_set(skb) ||
254 (skb_tail_pointer(skb) - skb_mac_header(skb)) < 2)) { 254 (skb_tail_pointer(skb) -
255 WARN_ON(1); 255 skb_mac_header(skb)) < IEEE802154_FC_LEN))
256 return cpu_to_le16(0); 256 return cpu_to_le16(0);
257 }
258 257
259 memcpy(&fc, skb_mac_header(skb), IEEE802154_FC_LEN); 258 memcpy(&fc, skb_mac_header(skb), IEEE802154_FC_LEN);
260 return fc; 259 return fc;