Skip to contentSkip to conversation

net: skbuff: Fix misleading comments for skb_put() and skb_push()

PATCH In review Ziran Zhang 2 participants 2 messages Jul 24 – Jul 25

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: skbuff: Fix misleading comments for skb_put() and skb_push()

Both functions only move the tail/data pointer, they do not copy data. Update the function descriptions and @len parameter, so they can accurately reflect the semantics.

---
 net/core/skbuff.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
net/core/skbuff.c +4 -4
index 18dabb4e9..35ad782ad 100644
@@ -2614,9 +2614,9 @@ void *pskb_put(struct sk_buff *skb, struct sk_buff *tail, int len)
 EXPORT_SYMBOL_GPL(pskb_put);
 
 /**
- *	skb_put - add data to a buffer
+ *	skb_put - extend the data area at the tail of a buffer
  *	@skb: buffer to use
- *	@len: amount of data to add
+ *	@len: number of bytes to extend
  *
  *	This function extends the used data area of the buffer. If this would
  *	exceed the total buffer size the kernel will panic. A pointer to the
@@ -2635,9 +2635,9 @@ void *skb_put(struct sk_buff *skb, unsigned int len)
 EXPORT_SYMBOL(skb_put);
 
 /**
- *	skb_push - add data to the start of a buffer
+ *	skb_push - extend the data area at the start of a buffer
  *	@skb: buffer to use
- *	@len: amount of data to add
+ *	@len: number of bytes to extend
  *
  *	This function extends the used data area of the buffer at the buffer
  *	start. If this would exceed the total buffer headroom the kernel will
Signature · 1 line
2.43.0
#1 lore raw
Quoted 5 lines · Ziran Zhang

Both functions only move the tail/data pointer, they do not copy data. Update the function descriptions and @len parameter, so they can accurately reflect the semantics.

This seems subjective and superfluous to me. Certainly not a fix. No mention of copy is made in the existing comments.

Quoted 35 lines
---
 net/core/skbuff.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
net/core/skbuff.c +4 -4
index 18dabb4e9..35ad782ad 100644
@@ -2614,9 +2614,9 @@ void *pskb_put(struct sk_buff *skb, struct sk_buff *tail, int len)
 EXPORT_SYMBOL_GPL(pskb_put);
 
 /**
- *	skb_put - add data to a buffer
+ *	skb_put - extend the data area at the tail of a buffer
  *	@skb: buffer to use
- *	@len: amount of data to add
+ *	@len: number of bytes to extend
  *
  *	This function extends the used data area of the buffer. If this would
  *	exceed the total buffer size the kernel will panic. A pointer to the
@@ -2635,9 +2635,9 @@ void *skb_put(struct sk_buff *skb, unsigned int len)
 EXPORT_SYMBOL(skb_put);
 
 /**
- *	skb_push - add data to the start of a buffer
+ *	skb_push - extend the data area at the start of a buffer
  *	@skb: buffer to use
- *	@len: amount of data to add
+ *	@len: number of bytes to extend
  *
  *	This function extends the used data area of the buffer at the buffer
  *	start. If this would exceed the total buffer headroom the kernel will
Signature · 1 line
2.43.0