From: Phil Sutter <phil@nwl.cc>
To: Pablo Neira Ayuso <pablo@netfilter.org>
Cc: netfilter-devel@vger.kernel.org
Subject: [nft PATCH] segtree: Fix expr_value_cmp()
Date: Thu, 6 Jul 2017 16:25:28 +0200 [thread overview]
Message-ID: <20170706142528.19715-1-phil@nwl.cc> (raw)
Instead of returning the result of mpz_cmp(), this function returned 1
unless both elements were equal and the first one had
EXPR_F_INTERVAL_END set.
Signed-off-by: Phil Sutter <phil@nwl.cc>
---
src/segtree.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/src/segtree.c b/src/segtree.c
index a2316a7b98041..f53536210018d 100644
--- a/src/segtree.c
+++ b/src/segtree.c
@@ -602,10 +602,12 @@ static int expr_value_cmp(const void *p1, const void *p2)
int ret;
ret = mpz_cmp(expr_value(e1)->value, expr_value(e2)->value);
- if (ret == 0 && (e1->flags & EXPR_F_INTERVAL_END))
- return -1;
- else
- return 1;
+ if (ret == 0) {
+ if (e1->flags & EXPR_F_INTERVAL_END)
+ return -1;
+ else if (e2->flags & EXPR_F_INTERVAL_END)
+ return 1;
+ }
return ret;
}
--
2.13.1
next reply other threads:[~2017-07-06 14:25 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-06 14:25 Phil Sutter [this message]
2017-07-06 14:48 ` [nft PATCH] segtree: Fix expr_value_cmp() Phil Sutter
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=20170706142528.19715-1-phil@nwl.cc \
--to=phil@nwl.cc \
--cc=netfilter-devel@vger.kernel.org \
--cc=pablo@netfilter.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).