* [PATCH] cipso: simplify cipso_v4_translate() when !CONFIG_NETLABEL
@ 2013-11-20 19:25 Paul Moore
2013-11-20 19:34 ` David Miller
0 siblings, 1 reply; 7+ messages in thread
From: Paul Moore @ 2013-11-20 19:25 UTC (permalink / raw)
To: netdev
Previous commits corrected some problems with cipso_v4_translate()
when CONFIG_NETLABEL=n but some additional work is needed to tidy
things up a bit.
Signed-off-by: Paul Moore <pmoore@redhat.com>
---
include/net/cipso_ipv4.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/net/cipso_ipv4.h b/include/net/cipso_ipv4.h
index a8c2ef6..2244e02 100644
--- a/include/net/cipso_ipv4.h
+++ b/include/net/cipso_ipv4.h
@@ -304,7 +304,7 @@ static inline int cipso_v4_validate(const struct sk_buff *skb,
for (opt_iter = 6; opt_iter < opt_len;) {
tag_len = opt[opt_iter + 1];
- if ((tag_len == 0) || (opt[opt_iter + 1] > (opt_len - opt_iter))) {
+ if ((tag_len == 0) || (tag_len > (opt_len - opt_iter))) {
err_offset = opt_iter + 1;
goto out;
}
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] cipso: simplify cipso_v4_translate() when !CONFIG_NETLABEL
2013-11-20 19:25 [PATCH] cipso: simplify cipso_v4_translate() when !CONFIG_NETLABEL Paul Moore
@ 2013-11-20 19:34 ` David Miller
2013-11-20 19:45 ` Paul Moore
0 siblings, 1 reply; 7+ messages in thread
From: David Miller @ 2013-11-20 19:34 UTC (permalink / raw)
To: pmoore; +Cc: netdev
From: Paul Moore <pmoore@redhat.com>
Date: Wed, 20 Nov 2013 14:25:48 -0500
> Previous commits corrected some problems with cipso_v4_translate()
> when CONFIG_NETLABEL=n but some additional work is needed to tidy
> things up a bit.
>
> Signed-off-by: Paul Moore <pmoore@redhat.com>
That's really vague, please describe exactly what is wrong with the
existing conditional and how you have fixed it.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] cipso: simplify cipso_v4_translate() when !CONFIG_NETLABEL
2013-11-20 19:34 ` David Miller
@ 2013-11-20 19:45 ` Paul Moore
2013-11-20 19:55 ` David Miller
0 siblings, 1 reply; 7+ messages in thread
From: Paul Moore @ 2013-11-20 19:45 UTC (permalink / raw)
To: David Miller; +Cc: netdev
On Wednesday, November 20, 2013 02:34:07 PM David Miller wrote:
> From: Paul Moore <pmoore@redhat.com>
> Date: Wed, 20 Nov 2013 14:25:48 -0500
>
> > Previous commits corrected some problems with cipso_v4_translate()
> > when CONFIG_NETLABEL=n but some additional work is needed to tidy
> > things up a bit.
> >
> > Signed-off-by: Paul Moore <pmoore@redhat.com>
>
> That's really vague, please describe exactly what is wrong with the
> existing conditional and how you have fixed it.
I kinda figured the one line patch and "some additional work is needed to tidy
things up a bit" summed it up nicely, but I guess not so here ya go ...
First, for reference, here is the diff one more time (some whitespace damage
in the paste below for readability):
> diff --git a/include/net/cipso_ipv4.h b/include/net/cipso_ipv4.h
> index a8c2ef6..2244e02 100644
> --- a/include/net/cipso_ipv4.h
> +++ b/include/net/cipso_ipv4.h
> @@ -304,7 +304,7 @@ static inline int cipso_v4_validate(...)
> for (opt_iter = 6; opt_iter < opt_len;) {
> tag_len = opt[opt_iter + 1];
>
> - if ((tag_len == 0) || (opt[opt_iter + 1] > (opt_len - opt_iter))) {
> + if ((tag_len == 0) || (tag_len > (opt_len - opt_iter))) {
> err_offset = opt_iter + 1;
> goto out;
> }
Looking at the original conditional:
if ((tag_len == 0) || (opt[opt_iter + 1] > (opt_len - opt_iter))
... and the replacement:
if ((tag_len == 0) || (tag_len > (opt_len - opt_iter)))
... we notice that "(opt[opt_iter + 1] > (opt_len - opt_iter))" has been
replaced with "(tag_len > (opt_len - opt_iter))", substituting 'tag_len' for
'opt[opt_iter + 1]'. This is acceptable because the the first statement in
the for loop is:
tag_len = opt[opt_iter + 1]
... which matches the substitution in the conditional. I'm not sure how much
more explicit I can be about this change, it is really pretty minor.
--
paul moore
security and virtualization @ redhat
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] cipso: simplify cipso_v4_translate() when !CONFIG_NETLABEL
2013-11-20 19:45 ` Paul Moore
@ 2013-11-20 19:55 ` David Miller
2013-11-20 19:59 ` Paul Moore
0 siblings, 1 reply; 7+ messages in thread
From: David Miller @ 2013-11-20 19:55 UTC (permalink / raw)
To: pmoore; +Cc: netdev
From: Paul Moore <pmoore@redhat.com>
Date: Wed, 20 Nov 2013 14:45:19 -0500
> Looking at the original conditional:
>
> if ((tag_len == 0) || (opt[opt_iter + 1] > (opt_len - opt_iter))
>
> ... and the replacement:
>
> if ((tag_len == 0) || (tag_len > (opt_len - opt_iter)))
>
> ... we notice that "(opt[opt_iter + 1] > (opt_len - opt_iter))" has been
> replaced with "(tag_len > (opt_len - opt_iter))", substituting 'tag_len' for
> 'opt[opt_iter + 1]'. This is acceptable because the the first statement in
> the for loop is:
>
> tag_len = opt[opt_iter + 1]
>
> ... which matches the substitution in the conditional. I'm not sure how much
> more explicit I can be about this change, it is really pretty minor.
Then, two things:
1) This is a cleanup, and therefore not suitable for submission right now
because the net-next tree is closed.
2) A more suitable commit log message would have been "Don't needlessly
recompute 'opt[opt_iter + 1]' as we already have it stored in tag_len".
Then anyone who reads this commit message can say "yes, obviously this
is a correct change and matches what the patch is doing"
Thanks.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] cipso: simplify cipso_v4_translate() when !CONFIG_NETLABEL
2013-11-20 19:55 ` David Miller
@ 2013-11-20 19:59 ` Paul Moore
2013-11-20 20:06 ` David Miller
0 siblings, 1 reply; 7+ messages in thread
From: Paul Moore @ 2013-11-20 19:59 UTC (permalink / raw)
To: David Miller; +Cc: netdev
On Wednesday, November 20, 2013 02:55:11 PM David Miller wrote:
> From: Paul Moore <pmoore@redhat.com>
> Date: Wed, 20 Nov 2013 14:45:19 -0500
>
> > Looking at the original conditional:
> > if ((tag_len == 0) || (opt[opt_iter + 1] > (opt_len - opt_iter))
> >
> > ... and the replacement:
> > if ((tag_len == 0) || (tag_len > (opt_len - opt_iter)))
> >
> > ... we notice that "(opt[opt_iter + 1] > (opt_len - opt_iter))" has been
> > replaced with "(tag_len > (opt_len - opt_iter))", substituting 'tag_len'
> > for 'opt[opt_iter + 1]'. This is acceptable because the the first
> > statement in>
> > the for loop is:
> > tag_len = opt[opt_iter + 1]
> >
> > ... which matches the substitution in the conditional. I'm not sure how
> > much more explicit I can be about this change, it is really pretty minor.
>
> Then, two things:
>
> 1) This is a cleanup, and therefore not suitable for submission right now
> because the net-next tree is closed.
I wasn't expecting it to go into the current merge window, I was just sending
it out now so you'd have it for when things started moving again. Think of it
as spreading the pain out a bit.
> 2) A more suitable commit log message would have been "Don't needlessly
> recompute 'opt[opt_iter + 1]' as we already have it stored in tag_len".
>
> Then anyone who reads this commit message can say "yes, obviously this
> is a correct change and matches what the patch is doing"
Fair enough. Do you want a resubmit with your wording once the merge window
closes?
> Thanks.
--
paul moore
security and virtualization @ redhat
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] cipso: simplify cipso_v4_translate() when !CONFIG_NETLABEL
2013-11-20 19:59 ` Paul Moore
@ 2013-11-20 20:06 ` David Miller
2013-11-20 20:09 ` Paul Moore
0 siblings, 1 reply; 7+ messages in thread
From: David Miller @ 2013-11-20 20:06 UTC (permalink / raw)
To: pmoore; +Cc: netdev
From: Paul Moore <pmoore@redhat.com>
Date: Wed, 20 Nov 2013 14:59:33 -0500
> On Wednesday, November 20, 2013 02:55:11 PM David Miller wrote:
>> 1) This is a cleanup, and therefore not suitable for submission right now
>> because the net-next tree is closed.
>
> I wasn't expecting it to go into the current merge window, I was just sending
> it out now so you'd have it for when things started moving again. Think of it
> as spreading the pain out a bit.
When the merge window opens, I make an announcement here on the list
politely asking pople to defer net-next patch submissions until after
the merge window closes and I explicitly announce that net-next is
open again.
>> 2) A more suitable commit log message would have been "Don't needlessly
>> recompute 'opt[opt_iter + 1]' as we already have it stored in tag_len".
>>
>> Then anyone who reads this commit message can say "yes, obviously this
>> is a correct change and matches what the patch is doing"
>
> Fair enough. Do you want a resubmit with your wording once the merge window
> closes?
... and I announce that net-next is open once more, yes. Thank you.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] cipso: simplify cipso_v4_translate() when !CONFIG_NETLABEL
2013-11-20 20:06 ` David Miller
@ 2013-11-20 20:09 ` Paul Moore
0 siblings, 0 replies; 7+ messages in thread
From: Paul Moore @ 2013-11-20 20:09 UTC (permalink / raw)
To: David Miller; +Cc: netdev
On Wednesday, November 20, 2013 03:06:20 PM David Miller wrote:
> From: Paul Moore <pmoore@redhat.com>
> Date: Wed, 20 Nov 2013 14:59:33 -0500
>
> > On Wednesday, November 20, 2013 02:55:11 PM David Miller wrote:
> >> 1) This is a cleanup, and therefore not suitable for submission right now
> >> because the net-next tree is closed.
> >
> > I wasn't expecting it to go into the current merge window, I was just
> > sending it out now so you'd have it for when things started moving again.
> > Think of it as spreading the pain out a bit.
>
> When the merge window opens, I make an announcement here on the list
> politely asking pople to defer net-next patch submissions until after
> the merge window closes and I explicitly announce that net-next is
> open again.
My apologies, I missed that. Subscribed to too many mailing lists and too
reliant on my filters to catch the important bits.
> >> 2) A more suitable commit log message would have been "Don't needlessly
> >> recompute 'opt[opt_iter + 1]' as we already have it stored in
> >> tag_len".
> >>
> >> Then anyone who reads this commit message can say "yes, obviously this
> >> is a correct change and matches what the patch is doing"
> >
> > Fair enough. Do you want a resubmit with your wording once the merge
> > window closes?
>
> ... and I announce that net-next is open once more, yes. Thank you.
Will do.
--
paul moore
security and virtualization @ redhat
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2013-11-20 20:09 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-20 19:25 [PATCH] cipso: simplify cipso_v4_translate() when !CONFIG_NETLABEL Paul Moore
2013-11-20 19:34 ` David Miller
2013-11-20 19:45 ` Paul Moore
2013-11-20 19:55 ` David Miller
2013-11-20 19:59 ` Paul Moore
2013-11-20 20:06 ` David Miller
2013-11-20 20:09 ` Paul Moore
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).