From: "Kris Katterjohn" <kjak@ispwest.com>
To: jschlst@samba.org
Cc: torvalds@osdl.org, linux-kernel@vger.kernel.org
Subject: [PATCH] Merge __load_pointer() and load_pointer() in net/core/filter.c; kernel 2.6.14
Date: Wed, 2 Nov 2005 00:41:15 -0800 [thread overview]
Message-ID: <e626300280b94e0abc26defcc6043b91.kjak@ispwest.com> (raw)
Another patch for net/core/filter.c by me. I merged __load_pointer() into
load_pointer(). I don't see a point in having two seperate functions when
both functions are really small and load_pointer() calls __load_pointer().
Renamed the variable "k" to "offset" since that's what it is, and in
skb_header_pointer() it's "offset".
This patch is a diff from kernel 2.6.14
Thanks
Signed-off-by: Kris Katterjohn <kjak@users.sourceforge.net>
---
--- x/net/core/filter.c 2005-10-27 19:02:08.000000000 -0500
+++ y/net/core/filter.c 2005-11-02 02:05:40.000000000 -0600
@@ -13,6 +13,8 @@
* 2 of the License, or (at your option) any later version.
*
* Andi Kleen - Fix a few bad bugs and races.
+ * Kris Katterjohn - Merged __load_pointer() into load_pointer() and
+ * cleaned it up a little bit - 2005-11-01
*/
#include <linux/module.h>
@@ -35,31 +37,27 @@
#include <asm/uaccess.h>
#include <linux/filter.h>
-/* No hurry in this branch */
-static void *__load_pointer(struct sk_buff *skb, int k)
+static inline void *load_pointer(struct sk_buff *skb, int offset,
+ unsigned int size, void *buffer)
{
u8 *ptr = NULL;
- if (k >= SKF_NET_OFF)
- ptr = skb->nh.raw + k - SKF_NET_OFF;
- else if (k >= SKF_LL_OFF)
- ptr = skb->mac.raw + k - SKF_LL_OFF;
+ if (offset >= 0)
+ return skb_header_pointer(skb, offset, size, buffer);
+
+ if (offset >= SKF_AD_OFF)
+ return NULL;
+
+ if (offset >= SKF_NET_OFF)
+ ptr = skb->nh.raw + offset - SKF_NET_OFF;
+
+ else if (offset >= SKF_LL_OFF)
+ ptr = skb->mac.raw + offset - SKF_LL_OFF;
if (ptr >= skb->head && ptr < skb->tail)
return ptr;
- return NULL;
-}
-static inline void *load_pointer(struct sk_buff *skb, int k,
- unsigned int size, void *buffer)
-{
- if (k >= 0)
- return skb_header_pointer(skb, k, size, buffer);
- else {
- if (k >= SKF_AD_OFF)
- return NULL;
- return __load_pointer(skb, k);
- }
+ return NULL;
}
/**
next reply other threads:[~2005-11-02 8:41 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-11-02 8:41 Kris Katterjohn [this message]
2005-11-03 1:50 ` Herbert Xu
2005-11-03 2:13 Kris Katterjohn
2005-11-03 2:30 ` Herbert Xu
2005-11-03 2:48 Kris Katterjohn
2005-11-03 5:51 Kris Katterjohn
2005-11-03 6:19 Kris Katterjohn
2005-11-03 6:58 ` Mitchell Blank Jr
2005-11-03 16:19 ` Patrick McHardy
2005-11-03 18:13 [PATCH] Merge __load_pointer() and load_pointer() in net/core/filter.c;kernel 2.6.14 Kris Katterjohn
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=e626300280b94e0abc26defcc6043b91.kjak@ispwest.com \
--to=kjak@ispwest.com \
--cc=jschlst@samba.org \
--cc=kjak@users.sourceforge.net \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@osdl.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®