Patchwork net: skb_trim explicitely check the linearity instead of data_len

login
register
mail settings
Submitter emmanuel.grumbach@intel.com
Date May 22, 2011, 5:46 a.m.
Message ID <1306043169-26659-1-git-send-email-emmanuel.grumbach@intel.com>
Download mbox | patch
Permalink /patch/96718/
State Accepted
Delegated to: David Miller
Headers show

Comments

emmanuel.grumbach@intel.com - May 22, 2011, 5:46 a.m.
From: Emmanuel Grumbach <emmanuel.grumbach@intel.com>

The purpose of the check on data_len is to check linearity, so use the inline
helper for this. No overhead and more explicit.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
---
 include/linux/skbuff.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
David Miller - May 23, 2011, 1:02 a.m.
From: emmanuel.grumbach@intel.com
Date: Sun, 22 May 2011 08:46:09 +0300

> From: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
> 
> The purpose of the check on data_len is to check linearity, so use the inline
> helper for this. No overhead and more explicit.
> 
> Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>

Applied.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index bf221d6..a4f680c 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -1439,7 +1439,7 @@  extern int ___pskb_trim(struct sk_buff *skb, unsigned int len);
 
 static inline void __skb_trim(struct sk_buff *skb, unsigned int len)
 {
-	if (unlikely(skb->data_len)) {
+	if (unlikely(skb_is_nonlinear(skb))) {
 		WARN_ON(1);
 		return;
 	}