netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Patrick McHardy <kaber@trash.net>
To: hadi@cyberus.ca
Cc: David Miller <davem@davemloft.net>, netdev@vger.kernel.org
Subject: Re: [XFRM] Optimize SA dumping
Date: Mon, 04 Dec 2006 13:36:27 +0100	[thread overview]
Message-ID: <4574164B.1000505@trash.net> (raw)
In-Reply-To: <1165163610.3517.96.camel@localhost>

jamal wrote:
>  	for (i = 0; i <= xfrm_state_hmask; i++) {
>  		hlist_for_each_entry(x, entry, xfrm_state_bydst+i, bydst) {
> +			if (count && send_x != last_x) {
> +				err = func(send_x, count, data);
> +				if (err)
> +					goto out;
> +				send_x = NULL;
> +			}
>  			if (!xfrm_id_proto_match(x->id.proto, proto))
>  				continue;

After you sent send_x and set it to NULL, it will be different from
last_x (since that is != NULL) and the NULL pointer will be given
to func() when continuing here.

> -			err = func(x, --count, data);
> -			if (err)
> -				goto out;
> +
> +			if (!count) {
> +				last_x = send_x = x;
> +			} else {
> +				send_x = last_x;
> +				last_x = x;
> +			}
> +			count++;
>  		}
>  	}





  reply	other threads:[~2006-12-04 12:33 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-12-03 16:33 [XFRM] Optimize SA dumping jamal
2006-12-04 12:36 ` Patrick McHardy [this message]
2006-12-04 13:27   ` jamal
2006-12-04 13:39     ` Patrick McHardy
2006-12-04 13:55       ` jamal

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=4574164B.1000505@trash.net \
    --to=kaber@trash.net \
    --cc=davem@davemloft.net \
    --cc=hadi@cyberus.ca \
    --cc=netdev@vger.kernel.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;
as well as URLs for NNTP newsgroup(s).