From: Alexei Starovoitov > Sent: 19 July 2023 00:40 > > Network drivers always call skb_header_pointer() with non-null buffer. > Remove !buffer check to prevent accidental misuse of skb_header_pointer(). > Introduce skb_pointer_if_linear() instead. > ... > +static inline void * __must_check > +skb_pointer_if_linear(const struct sk_buff *skb, int offset, int len) > +{ > + if (likely(skb_headlen(skb) - offset >= len)) > + return skb->data + offset; > + return NULL; > +} Shouldn't both 'offset' and 'len' be 'unsigned int' ? The check should probably be written: offset + len <= skb_headlen(skb) so that it fails if 'offset' is also large. (Provided 'offset + len' itself doesn't wrap.) I've swapped the order because I prefer conditional to be if (variable op constant) and in this case skb_headlen() is the more constant value. David - Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK Registration No: 1397386 (Wales)