ppp: Remove direct skb_queue_head list pointer access.
authorDavid S. Miller <davem@davemloft.net>
Sun, 12 Aug 2018 01:43:38 +0000 (18:43 -0700)
committerDavid S. Miller <davem@davemloft.net>
Mon, 10 Sep 2018 17:06:53 +0000 (10:06 -0700)
Add a helper, __skb_peek(), and use it in ppp_mp_reconstruct().

Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ppp/ppp_generic.c
include/linux/skbuff.h

index 02ad03a2fab773cd36707e50434cc559fc639f7c..500bc0027c1b3da1a36a92b1fe5789ffb20ef4e0 100644 (file)
@@ -2400,7 +2400,7 @@ ppp_mp_reconstruct(struct ppp *ppp)
 
        if (ppp->mrru == 0)     /* do nothing until mrru is set */
                return NULL;
-       head = list->next;
+       head = __skb_peek(list);
        tail = NULL;
        skb_queue_walk_safe(list, p, tmp) {
        again:
index 17a13e4785fc3c15594c8aaee5132c44449a954a..89283b77294d7a2ed57aac75e8297e1f0cf556c0 100644 (file)
@@ -1592,6 +1592,17 @@ static inline struct sk_buff *skb_peek(const struct sk_buff_head *list_)
        return skb;
 }
 
+/**
+ *     __skb_peek - peek at the head of a non-empty &sk_buff_head
+ *     @list_: list to peek at
+ *
+ *     Like skb_peek(), but the caller knows that the list is not empty.
+ */
+static inline struct sk_buff *__skb_peek(const struct sk_buff_head *list_)
+{
+       return list_->next;
+}
+
 /**
  *     skb_peek_next - peek skb following the given one from a queue
  *     @skb: skb to start from