login
Login
/
Register
Search
Search this site:
Forums
News
Blogs
Features
Site
Home
»
Mailing list archives
»
linux-kernel
»
2010
»
November
»
15
Re: [PATCH] Reduce number of pointer dereferences in IPv6 netfilter LOG module function dump_packet()
view
thread
Previous message: [
thread
] [
date
] [
author
]
Next message: [
thread
] [
date
] [
author
]
[view in full thread]
From: Eric Dumazet
Subject:
Re: [PATCH] Reduce number of pointer dereferences in IPv6 netfilter LOG module function dump_packet()
Date: Sunday, November 14, 2010 - 5:50 pm
Le dimanche 14 novembre 2010 à 22:47 +0100, Jesper Juhl a écrit :
quoted text
> By adding two pointer variables to > net/ipv6/netfilter/ip6t_LOG.c::dump_packet() we can save 19 bytes of .text > and many pointer dereferences. > > before: > text data bss dec hex filename > 6258 600 3088 9946 26da net/ipv6/netfilter/ip6t_LOG.o > > after: > text data bss dec hex filename > 6239 600 3088 9927 26c7 net/ipv6/netfilter/ip6t_LOG.o > > > Please Cc me on replies. > > > Signed-off-by: Jesper Juhl <jj@chaosbits.net> > --- > ip6t_LOG.c | 16 ++++++++++------ > 1 file changed, 10 insertions(+), 6 deletions(-) > > diff --git a/net/ipv6/netfilter/ip6t_LOG.c b/net/ipv6/netfilter/ip6t_LOG.c > index 09c8889..51d10a5 100644 > --- a/net/ipv6/netfilter/ip6t_LOG.c > +++ b/net/ipv6/netfilter/ip6t_LOG.c > @@ -46,6 +46,8 @@ static void dump_packet(struct sbuff *m, > unsigned int ptr; > unsigned int hdrlen = 0; > unsigned int logflags; > + struct sock *sk; > + struct socket *sk_socket; > > if (info->type == NF_LOG_TYPE_LOG) > logflags = info->u.log.logflags; > @@ -358,13 +360,15 @@ static void dump_packet(struct sbuff *m, > } > > /* Max length: 15 "UID=4294967295 " */ > - if ((logflags & IP6T_LOG_UID) && recurse && skb->sk) { > - read_lock_bh(&skb->sk->sk_callback_lock); > - if (skb->sk->sk_socket && skb->sk->sk_socket->file) > + sk = skb->sk; > + sk_socket = sk->sk_socket; > + if ((logflags & IP6T_LOG_UID) && recurse && sk) { > + read_lock_bh(&sk->sk_callback_lock); > + if (sk_socket && sk_socket->file) > sb_add(m, "UID=%u GID=%u ", > - skb->sk->sk_socket->file->f_cred->fsuid, > - skb->sk->sk_socket->file->f_cred->fsgid); > - read_unlock_bh(&skb->sk->sk_callback_lock); > + sk_socket->file->f_cred->fsuid, > + sk_socket->file->f_cred->fsgid); > + read_unlock_bh(&sk->sk_callback_lock); > } > > /* Max length: 16 "MARK=0xFFFFFFFF " */ > > >
Same comment than previous patch, you add a NULL dereference. --
unsubscribe notice
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to
majordomo@vger.kernel.org
More majordomo info at
http://vger.kernel.org/majordomo-info.html
Please read the FAQ at
http://www.tux.org/lkml/
Previous message: [
thread
] [
date
] [
author
]
Next message: [
thread
] [
date
] [
author
]
Messages in current thread:
[PATCH] Reduce number of pointer dereferences in IPv6 netf ...
, Jesper Juhl
, (Sun Nov 14, 2:47 pm)
Re: [PATCH] Reduce number of pointer dereferences in IPv6 ...
, Eric Dumazet
, (Sun Nov 14, 5:50 pm)
Re: [PATCH] Reduce number of pointer dereferences in IPv6 ...
, Jesper Juhl
, (Mon Nov 15, 2:50 pm)
Navigation
Create content
Mailing list archives
Recent posts
Popular discussions
linux-kernel
:
Paul Turner
[tg_shares_up rewrite v4 11/11] sched: update tg->shares after cpu.shares write
Mr. James W. Laferriere
Re: Linux 2.6.25-rc1 , syntax error near unexpected token `;'
Linus Torvalds
Linux 2.6.34-rc4
Colin Cross
[PATCH 12/21] ARM: tegra: Add suspend and hotplug support
Chuck Ebbert
Re: PCI: Unable to reserve mem region problem
git
:
Fredrik Kuivinen
Re: fatal: unable to create '.git/index': File exists
Wink Saville
How-to combine several separate git repos?
Emily Ren
How to pull remote branch with specified commit id?
Denis Bueno
Git clone error
pradeep singh
git-update-server-info may be required,cannot clone and pull from a remote reposit...
linux-netdev
:
Jamie Lokier
Re: POHMELFS high performance network filesystem. Transactions, failover, performa...
Timo Teräs
ip xfrm policy semantics
Jarek Poplawski
Re: socket api problem: can't bind an ipv6 socket to ::ffff:0.0.0.0
Michael S. Tsirkin
[PATCH 3/3] vhost: fix get_user_pages_fast error handling
Jeff Garzik
Re: [0/3] POHMELFS high performance network filesystem. First steps in parallel pr...
openbsd-misc
:
Sevan / Venture37
Re: This is what Linus Torvalds calls openBSD crowd
Netmaffia.hu
Tini Lányok AKCIÓBAN OTTHON
Siju George
This is what Linus Torvalds calls openBSD crowd
Darrin Chandler
Re: OT: Python (was Re: vi in /bin)
frantisek holop
Re: splassert: vwakeup: and friends
git-commits-head
:
Linux Kernel Mailing List
ASoC: fix registration of the SoC card in the Freescale MPC8610 drivers
Linux Kernel Mailing List
drivers/acpi: use kasprintf
Linux Kernel Mailing List
powerpc/fsl_msi: enable msi allocation in all banks
Linux Kernel Mailing List
bnx2x: Moving includes
Linux Kernel Mailing List
nfsd41: sanity check client drc maxreqs
Colocation donated by:
Syndicate