netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] ematch: Fix the matching of inverted containers (again).
@ 2014-10-03  8:06 Ignacy Gawędzki
  2014-10-03 12:22 ` Sergei Shtylyov
  0 siblings, 1 reply; 5+ messages in thread
From: Ignacy Gawędzki @ 2014-10-03  8:06 UTC (permalink / raw)
  To: netdev

The result of a negated container has to be inverted before checking for
early ending.

Signed-off-by: Ignacy Gawędzki <ignacy.gawedzki@green-communications.fr>
---
 net/sched/ematch.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/net/sched/ematch.c b/net/sched/ematch.c
index ad57f44..300ecf6 100644
--- a/net/sched/ematch.c
+++ b/net/sched/ematch.c
@@ -526,11 +526,12 @@ pop_stack:
 		match_idx = stack[--stackp];
 		cur_match = tcf_em_get_match(tree, match_idx);
 
-		if (tcf_em_early_end(cur_match, res)) {
-			if (tcf_em_is_inverted(cur_match))
-				res = !res;
+		if (tcf_em_is_inverted(cur_match))
+			res = !res;
+
+		if (tcf_em_early_end(cur_match, res))
 			goto pop_stack;
-		} else {
+		else {
 			match_idx++;
 			goto proceed;
 		}
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH net] ematch: Fix the matching of inverted containers (again).
  2014-10-03  8:06 [PATCH net] ematch: Fix the matching of inverted containers (again) Ignacy Gawędzki
@ 2014-10-03 12:22 ` Sergei Shtylyov
  2014-10-03 13:44   ` [PATCH net v2 0/1] " Ignacy Gawędzki
  2014-10-03 13:44   ` [PATCH net v2 1/1] ematch: Fix early ending of inverted containers Ignacy Gawędzki
  0 siblings, 2 replies; 5+ messages in thread
From: Sergei Shtylyov @ 2014-10-03 12:22 UTC (permalink / raw)
  To: Ignacy Gawędzki, netdev

Hello.

On 10/3/2014 12:06 PM, Ignacy Gawędzki wrote:

> The result of a negated container has to be inverted before checking for
> early ending.

> Signed-off-by: Ignacy Gawędzki <ignacy.gawedzki@green-communications.fr>
> ---
>   net/sched/ematch.c | 9 +++++----
>   1 file changed, 5 insertions(+), 4 deletions(-)

> diff --git a/net/sched/ematch.c b/net/sched/ematch.c
> index ad57f44..300ecf6 100644
> --- a/net/sched/ematch.c
> +++ b/net/sched/ematch.c
> @@ -526,11 +526,12 @@ pop_stack:
>   		match_idx = stack[--stackp];
>   		cur_match = tcf_em_get_match(tree, match_idx);
>
> -		if (tcf_em_early_end(cur_match, res)) {
> -			if (tcf_em_is_inverted(cur_match))
> -				res = !res;
> +		if (tcf_em_is_inverted(cur_match))
> +			res = !res;
> +
> +		if (tcf_em_early_end(cur_match, res))
>   			goto pop_stack;
> -		} else {
> +		else {
>   			match_idx++;
>   			goto proceed;
>   		}

    The kernel style dictates that an *if* statement should have {} in all its 
arms, if it has {} in at least one of the arms.

WBR, Sergei

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH net v2 0/1] Re: ematch: Fix the matching of inverted containers (again).
  2014-10-03 12:22 ` Sergei Shtylyov
@ 2014-10-03 13:44   ` Ignacy Gawędzki
  2014-10-03 13:44   ` [PATCH net v2 1/1] ematch: Fix early ending of inverted containers Ignacy Gawędzki
  1 sibling, 0 replies; 5+ messages in thread
From: Ignacy Gawędzki @ 2014-10-03 13:44 UTC (permalink / raw)
  To: netdev

On Fri, Oct 03, 2014 at 04:22:29PM +0400, thus spake Sergei Shtylyov:
>    The kernel style dictates that an *if* statement should have {}
> in all its arms, if it has {} in at least one of the arms.

Hi,

Thanks for your kind remark.  Fixed patch follows.

Ignacy Gawędzki (1):
  ematch: Fix early ending of inverted containers.

 net/sched/ematch.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

-- 
1.9.1

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH net v2 1/1] ematch: Fix early ending of inverted containers.
  2014-10-03 12:22 ` Sergei Shtylyov
  2014-10-03 13:44   ` [PATCH net v2 0/1] " Ignacy Gawędzki
@ 2014-10-03 13:44   ` Ignacy Gawędzki
  2014-10-05  0:50     ` David Miller
  1 sibling, 1 reply; 5+ messages in thread
From: Ignacy Gawędzki @ 2014-10-03 13:44 UTC (permalink / raw)
  To: netdev

The result of a negated container has to be inverted before checking for
early ending.

This fixes my previous attempt (17c9c8232663a47f074b7452b9b034efda868ca7) to
make inverted containers work correctly.

Signed-off-by: Ignacy Gawędzki <ignacy.gawedzki@green-communications.fr>
---
 net/sched/ematch.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/net/sched/ematch.c b/net/sched/ematch.c
index ad57f44..f878fa1 100644
--- a/net/sched/ematch.c
+++ b/net/sched/ematch.c
@@ -526,9 +526,10 @@ pop_stack:
 		match_idx = stack[--stackp];
 		cur_match = tcf_em_get_match(tree, match_idx);
 
+		if (tcf_em_is_inverted(cur_match))
+			res = !res;
+
 		if (tcf_em_early_end(cur_match, res)) {
-			if (tcf_em_is_inverted(cur_match))
-				res = !res;
 			goto pop_stack;
 		} else {
 			match_idx++;
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH net v2 1/1] ematch: Fix early ending of inverted containers.
  2014-10-03 13:44   ` [PATCH net v2 1/1] ematch: Fix early ending of inverted containers Ignacy Gawędzki
@ 2014-10-05  0:50     ` David Miller
  0 siblings, 0 replies; 5+ messages in thread
From: David Miller @ 2014-10-05  0:50 UTC (permalink / raw)
  To: ignacy.gawedzki; +Cc: netdev

From: Ignacy Gawędzki <ignacy.gawedzki@green-communications.fr>
Date: Fri, 3 Oct 2014 15:44:48 +0200

> The result of a negated container has to be inverted before checking for
> early ending.
> 
> This fixes my previous attempt (17c9c8232663a47f074b7452b9b034efda868ca7) to
> make inverted containers work correctly.
> 
> Signed-off-by: Ignacy Gawędzki <ignacy.gawedzki@green-communications.fr>

Applied.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2014-10-05  0:50 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-10-03  8:06 [PATCH net] ematch: Fix the matching of inverted containers (again) Ignacy Gawędzki
2014-10-03 12:22 ` Sergei Shtylyov
2014-10-03 13:44   ` [PATCH net v2 0/1] " Ignacy Gawędzki
2014-10-03 13:44   ` [PATCH net v2 1/1] ematch: Fix early ending of inverted containers Ignacy Gawędzki
2014-10-05  0:50     ` David Miller

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).