* Re: [PATCH] ipv4: remove a call to skb_queue_len() in inet_diag.c
[not found] ` <20070204142921.GA5787@unknown-00-0d-60-79-ca-00.lan>
@ 2007-02-04 20:23 ` David Miller
2007-02-04 20:41 ` Thomas Hisch
0 siblings, 1 reply; 3+ messages in thread
From: David Miller @ 2007-02-04 20:23 UTC (permalink / raw)
To: t.hisch; +Cc: linux-kernel, netdev
From: Thomas Hisch <t.hisch@gmail.com>
Date: Sun, 4 Feb 2007 15:29:21 +0100
> remove unneeded call to skb_queue_len (skb_dequeue already checks queuelen) and
> replace a sizeof() by a Netlink Macro
>
> Signed-off-by: Thomas Hisch <t.hisch@gmail.com>
You don't understand the code you are editing :-)
We want to process the number of packets present when we
start the function, other threads can add more packets to
the queue meanwhile and we don't want to keep dequeueing
in that case or else we can theoretically run forever with
a fast enough producer.
Also, please post all networking patches to netdev@vger.kernel.org,
the majority of the networking developers do not read linux-kernel.
Thank you.
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] ipv4: remove a call to skb_queue_len() in inet_diag.c
2007-02-04 20:23 ` [PATCH] ipv4: remove a call to skb_queue_len() in inet_diag.c David Miller
@ 2007-02-04 20:41 ` Thomas Hisch
0 siblings, 0 replies; 3+ messages in thread
From: Thomas Hisch @ 2007-02-04 20:41 UTC (permalink / raw)
To: netdev
On 2/4/07, David Miller <davem@davemloft.net> wrote:
> From: Thomas Hisch <t.hisch@gmail.com>
> Date: Sun, 4 Feb 2007 15:29:21 +0100
>
> > remove unneeded call to skb_queue_len (skb_dequeue already checks queuelen) and
> > replace a sizeof() by a Netlink Macro
> >
> > Signed-off-by: Thomas Hisch <t.hisch@gmail.com>
>
> You don't understand the code you are editing :-)
>
> We want to process the number of packets present when we
> start the function, other threads can add more packets to
> the queue meanwhile and we don't want to keep dequeueing
> in that case or else we can theoretically run forever with
> a fast enough producer.
>
> Also, please post all networking patches to netdev@vger.kernel.org,
> the majority of the networking developers do not read linux-kernel.
>
> Thank you.
>
thanks for the advice. next time i should look more closely at the code ;)
i thought that this was a candidate for a cleanup as no other netlink
protocol used such a while loop condition.
Thomas.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH] ipv4: remove a call to skb_queue_len() in inet_diag.c
@ 2007-02-04 15:34 Thomas Hisch
0 siblings, 0 replies; 3+ messages in thread
From: Thomas Hisch @ 2007-02-04 15:34 UTC (permalink / raw)
To: linux-kernel; +Cc: netdev
remove unneeded call to skb_queue_len (skb_dequeue already checks queuelen) and
replace a sizeof() by a Netlink Macro
Signed-off-by: Thomas Hisch <t.hisch@gmail.com>
---
sorry, my previous version of this patch didn't conform to the Codingstyle document.
now everything should be fine.
net/ipv4/inet_diag.c | 5 ++---
1 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/net/ipv4/inet_diag.c b/net/ipv4/inet_diag.c
index 77761ac..9cf27c7 100644
--- a/net/ipv4/inet_diag.c
+++ b/net/ipv4/inet_diag.c
@@ -846,7 +846,7 @@ static inline void inet_diag_rcv_skb(struct sk_buff *skb)
int err;
struct nlmsghdr *nlh = (struct nlmsghdr *)skb->data;
- if (nlh->nlmsg_len < sizeof(*nlh) ||
+ if (nlh->nlmsg_len < NLMSG_HDRLEN ||
skb->len < nlh->nlmsg_len)
return;
err = inet_diag_rcv_msg(skb, nlh);
@@ -858,9 +858,8 @@ static inline void inet_diag_rcv_skb(struct sk_buff *skb)
static void inet_diag_rcv(struct sock *sk, int len)
{
struct sk_buff *skb;
- unsigned int qlen = skb_queue_len(&sk->sk_receive_queue);
- while (qlen-- && (skb = skb_dequeue(&sk->sk_receive_queue))) {
+ while ((skb = skb_dequeue(&sk->sk_receive_queue)) != NULL) {
inet_diag_rcv_skb(skb);
kfree_skb(skb);
}
--
1.5.0.rc3.22.g5057
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2007-02-04 20:41 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <Pine.LNX.4.64.0612311547200.30821@localhost.localdomain>
[not found] ` <20070204142921.GA5787@unknown-00-0d-60-79-ca-00.lan>
2007-02-04 20:23 ` [PATCH] ipv4: remove a call to skb_queue_len() in inet_diag.c David Miller
2007-02-04 20:41 ` Thomas Hisch
2007-02-04 15:34 Thomas Hisch
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox