* [PATCH] net sched: text ematch: zero out ts_state before using it
@ 2014-10-09 16:05 Omar Sandoval
2014-10-09 16:28 ` Omar Sandoval
2014-10-09 21:48 ` Cong Wang
0 siblings, 2 replies; 4+ messages in thread
From: Omar Sandoval @ 2014-10-09 16:05 UTC (permalink / raw)
To: Jamal Hadi Salim, David S. Miller, netdev, linux-kernel; +Cc: Omar Sandoval
textsearch_find zeroes out the offset, but the control buffer (which may or may
not matter in this case) needs to be zeroed out as well.
Signed-off-by: Omar Sandoval <osandov@osandov.com>
---
net/sched/em_text.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/net/sched/em_text.c b/net/sched/em_text.c
index 15d353d..2a1b6d9 100644
--- a/net/sched/em_text.c
+++ b/net/sched/em_text.c
@@ -36,6 +36,8 @@ static int em_text_match(struct sk_buff *skb, struct tcf_ematch *m,
int from, to;
struct ts_state state;
+ memset(&state, 0, sizeof(state));
+
from = tcf_get_base_ptr(skb, tm->from_layer) - skb->data;
from += tm->from_offset;
--
2.1.2
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] net sched: text ematch: zero out ts_state before using it
2014-10-09 16:05 [PATCH] net sched: text ematch: zero out ts_state before using it Omar Sandoval
@ 2014-10-09 16:28 ` Omar Sandoval
2014-10-09 21:48 ` Cong Wang
1 sibling, 0 replies; 4+ messages in thread
From: Omar Sandoval @ 2014-10-09 16:28 UTC (permalink / raw)
To: Jamal Hadi Salim, David S. Miller, netdev, linux-kernel
On Thu, Oct 09, 2014 at 09:05:21AM -0700, Omar Sandoval wrote:
> textsearch_find zeroes out the offset, but the control buffer (which may or may
> not matter in this case) needs to be zeroed out as well.
>
> Signed-off-by: Omar Sandoval <osandov@osandov.com>
> ---
> net/sched/em_text.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/net/sched/em_text.c b/net/sched/em_text.c
> index 15d353d..2a1b6d9 100644
> --- a/net/sched/em_text.c
> +++ b/net/sched/em_text.c
> @@ -36,6 +36,8 @@ static int em_text_match(struct sk_buff *skb, struct tcf_ematch *m,
> int from, to;
> struct ts_state state;
>
> + memset(&state, 0, sizeof(state));
> +
> from = tcf_get_base_ptr(skb, tm->from_layer) - skb->data;
> from += tm->from_offset;
>
> --
> 2.1.2
>
I forgot to mention: this patch is against 3.17.
--
Omar
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] net sched: text ematch: zero out ts_state before using it
2014-10-09 16:05 [PATCH] net sched: text ematch: zero out ts_state before using it Omar Sandoval
2014-10-09 16:28 ` Omar Sandoval
@ 2014-10-09 21:48 ` Cong Wang
2014-10-09 21:54 ` Omar Sandoval
1 sibling, 1 reply; 4+ messages in thread
From: Cong Wang @ 2014-10-09 21:48 UTC (permalink / raw)
To: Omar Sandoval
Cc: Jamal Hadi Salim, David S. Miller, netdev,
linux-kernel@vger.kernel.org
On Thu, Oct 9, 2014 at 9:05 AM, Omar Sandoval <osandov@osandov.com> wrote:
> textsearch_find zeroes out the offset, but the control buffer (which may or may
> not matter in this case) needs to be zeroed out as well.
Why? skb_prepare_seq_read() initializes the cb.
Also, the comment says:
* @state: uninitialized textsearch state variable
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] net sched: text ematch: zero out ts_state before using it
2014-10-09 21:48 ` Cong Wang
@ 2014-10-09 21:54 ` Omar Sandoval
0 siblings, 0 replies; 4+ messages in thread
From: Omar Sandoval @ 2014-10-09 21:54 UTC (permalink / raw)
To: Cong Wang
Cc: Jamal Hadi Salim, David S. Miller, netdev,
linux-kernel@vger.kernel.org
On Thu, Oct 09, 2014 at 02:48:54PM -0700, Cong Wang wrote:
> On Thu, Oct 9, 2014 at 9:05 AM, Omar Sandoval <osandov@osandov.com> wrote:
> > textsearch_find zeroes out the offset, but the control buffer (which may or may
> > not matter in this case) needs to be zeroed out as well.
>
> Why? skb_prepare_seq_read() initializes the cb.
>
> Also, the comment says:
>
> * @state: uninitialized textsearch state variable
Mm, thanks, I missed that. It looks like every other caller of skb_find_text is
doing an unnecessary memset in that case. Disregard this, I guess.
--
Omar
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2014-10-09 21:54 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-10-09 16:05 [PATCH] net sched: text ematch: zero out ts_state before using it Omar Sandoval
2014-10-09 16:28 ` Omar Sandoval
2014-10-09 21:48 ` Cong Wang
2014-10-09 21:54 ` Omar Sandoval
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).