Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Alexander Aring and committed by
Marcel Holtmann
048e7f7e 38961294

+3 -4
+3 -4
include/net/mac802154.h
··· 250 250 __le16 fc; 251 251 252 252 /* check if we can fc at skb_mac_header of sk buffer */ 253 - if (unlikely(!skb_mac_header_was_set(skb) || 254 - (skb_tail_pointer(skb) - skb_mac_header(skb)) < 2)) { 255 - WARN_ON(1); 253 + if (WARN_ON(!skb_mac_header_was_set(skb) || 254 + (skb_tail_pointer(skb) - 255 + skb_mac_header(skb)) < IEEE802154_FC_LEN)) 256 256 return cpu_to_le16(0); 257 - } 258 257 259 258 memcpy(&fc, skb_mac_header(skb), IEEE802154_FC_LEN); 260 259 return fc;