public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [patch] ftrace: clear bits properly in reset_iter_read()
@ 2012-06-09 16:10 Dan Carpenter
  2012-06-09 16:57 ` Steven Rostedt
  2012-12-09 11:30 ` [tip:perf/urgent] ftrace: Clear bits properly in reset_iter_read( ) tip-bot for Dan Carpenter
  0 siblings, 2 replies; 4+ messages in thread
From: Dan Carpenter @ 2012-06-09 16:10 UTC (permalink / raw)
  To: Steven Rostedt
  Cc: Frederic Weisbecker, Ingo Molnar, linux-kernel, kernel-janitors

There is a typo here where '&' is used instead of '|' and it turns the
statement into a noop.  The original code is equivalent to:

	iter->flags &= ~((1 << 2) & (1 << 4));

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
This is a static checker fix and I'm not super familiar with ftrace.
Please review carefully.

diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index a008663..97da2dc 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -2358,7 +2358,7 @@ static void reset_iter_read(struct ftrace_iterator *iter)
 {
 	iter->pos = 0;
 	iter->func_pos = 0;
-	iter->flags &= ~(FTRACE_ITER_PRINTALL & FTRACE_ITER_HASH);
+	iter->flags &= ~(FTRACE_ITER_PRINTALL | FTRACE_ITER_HASH);
 }
 
 static void *t_start(struct seq_file *m, loff_t *pos)

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

* Re: [patch] ftrace: clear bits properly in reset_iter_read()
  2012-06-09 16:10 [patch] ftrace: clear bits properly in reset_iter_read() Dan Carpenter
@ 2012-06-09 16:57 ` Steven Rostedt
  2012-11-15 21:05   ` Steven Rostedt
  2012-12-09 11:30 ` [tip:perf/urgent] ftrace: Clear bits properly in reset_iter_read( ) tip-bot for Dan Carpenter
  1 sibling, 1 reply; 4+ messages in thread
From: Steven Rostedt @ 2012-06-09 16:57 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Frederic Weisbecker, Ingo Molnar, linux-kernel, kernel-janitors

On Sat, 2012-06-09 at 19:10 +0300, Dan Carpenter wrote:
> There is a typo here where '&' is used instead of '|' and it turns the
> statement into a noop.  The original code is equivalent to:
> 
> 	iter->flags &= ~((1 << 2) & (1 << 4));
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
> This is a static checker fix and I'm not super familiar with ftrace.
> Please review carefully.
> 
> diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
> index a008663..97da2dc 100644
> --- a/kernel/trace/ftrace.c
> +++ b/kernel/trace/ftrace.c
> @@ -2358,7 +2358,7 @@ static void reset_iter_read(struct ftrace_iterator *iter)
>  {
>  	iter->pos = 0;
>  	iter->func_pos = 0;
> -	iter->flags &= ~(FTRACE_ITER_PRINTALL & FTRACE_ITER_HASH);
> +	iter->flags &= ~(FTRACE_ITER_PRINTALL | FTRACE_ITER_HASH);

Thanks! This is a real minor bug, but as it is a simple fix I will
probably queue it up for 3.5 and stable. The reason that it has gone
unnoticed for so long is that this would only show up if you did a lseek
on the function list file. Which is not a common operation to do.

I checked the code and if someone were to do an lseek with these flags
set then they would just get the hash list again (and not the function
list). It's a bug, yes, but not a big one.

I'll queue it up on Monday.

-- Steve


>  }
>  
>  static void *t_start(struct seq_file *m, loff_t *pos)



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

* Re: [patch] ftrace: clear bits properly in reset_iter_read()
  2012-06-09 16:57 ` Steven Rostedt
@ 2012-11-15 21:05   ` Steven Rostedt
  0 siblings, 0 replies; 4+ messages in thread
From: Steven Rostedt @ 2012-11-15 21:05 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Frederic Weisbecker, Ingo Molnar, linux-kernel, kernel-janitors

(Doing my slow clean ups, I find lots of coins under the couch cushions)

On Sat, 2012-06-09 at 12:57 -0400, Steven Rostedt wrote:
> On Sat, 2012-06-09 at 19:10 +0300, Dan Carpenter wrote:
> > There is a typo here where '&' is used instead of '|' and it turns the
> > statement into a noop.  The original code is equivalent to:
> > 
> > 	iter->flags &= ~((1 << 2) & (1 << 4));
> > 
> > Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> > ---
> > This is a static checker fix and I'm not super familiar with ftrace.
> > Please review carefully.
> > 
> > diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
> > index a008663..97da2dc 100644
> > --- a/kernel/trace/ftrace.c
> > +++ b/kernel/trace/ftrace.c
> > @@ -2358,7 +2358,7 @@ static void reset_iter_read(struct ftrace_iterator *iter)
> >  {
> >  	iter->pos = 0;
> >  	iter->func_pos = 0;
> > -	iter->flags &= ~(FTRACE_ITER_PRINTALL & FTRACE_ITER_HASH);
> > +	iter->flags &= ~(FTRACE_ITER_PRINTALL | FTRACE_ITER_HASH);
> 
> Thanks! This is a real minor bug, but as it is a simple fix I will
> probably queue it up for 3.5 and stable. The reason that it has gone
> unnoticed for so long is that this would only show up if you did a lseek
> on the function list file. Which is not a common operation to do.
> 
> I checked the code and if someone were to do an lseek with these flags
> set then they would just get the hash list again (and not the function
> list). It's a bug, yes, but not a big one.
> 
> I'll queue it up on Monday.
> 

I just didn't say *which* Monday :-p

Bah, this got lost in a rebase somehow. Grumble, I should push this out
now as urgent.

-- Steve

> 
> >  }
> >  
> >  static void *t_start(struct seq_file *m, loff_t *pos)
> 



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

* [tip:perf/urgent] ftrace: Clear bits properly in reset_iter_read( )
  2012-06-09 16:10 [patch] ftrace: clear bits properly in reset_iter_read() Dan Carpenter
  2012-06-09 16:57 ` Steven Rostedt
@ 2012-12-09 11:30 ` tip-bot for Dan Carpenter
  1 sibling, 0 replies; 4+ messages in thread
From: tip-bot for Dan Carpenter @ 2012-12-09 11:30 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, rostedt, tglx, dan.carpenter

Commit-ID:  70f77b3f7ec010ff9624c1f2e39a81babc9e2429
Gitweb:     http://git.kernel.org/tip/70f77b3f7ec010ff9624c1f2e39a81babc9e2429
Author:     Dan Carpenter <dan.carpenter@oracle.com>
AuthorDate: Sat, 9 Jun 2012 19:10:27 +0300
Committer:  Steven Rostedt <rostedt@goodmis.org>
CommitDate: Thu, 15 Nov 2012 16:10:17 -0500

ftrace: Clear bits properly in reset_iter_read()

There is a typo here where '&' is used instead of '|' and it turns the
statement into a noop.  The original code is equivalent to:

	iter->flags &= ~((1 << 2) & (1 << 4));

Link: http://lkml.kernel.org/r/20120609161027.GD6488@elgon.mountain

Cc: stable@vger.kernel.org # all of them
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 kernel/trace/ftrace.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index 9dcf15d..51b7159 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -2437,7 +2437,7 @@ static void reset_iter_read(struct ftrace_iterator *iter)
 {
 	iter->pos = 0;
 	iter->func_pos = 0;
-	iter->flags &= ~(FTRACE_ITER_PRINTALL & FTRACE_ITER_HASH);
+	iter->flags &= ~(FTRACE_ITER_PRINTALL | FTRACE_ITER_HASH);
 }
 
 static void *t_start(struct seq_file *m, loff_t *pos)

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

end of thread, other threads:[~2012-12-09 11:31 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-06-09 16:10 [patch] ftrace: clear bits properly in reset_iter_read() Dan Carpenter
2012-06-09 16:57 ` Steven Rostedt
2012-11-15 21:05   ` Steven Rostedt
2012-12-09 11:30 ` [tip:perf/urgent] ftrace: Clear bits properly in reset_iter_read( ) tip-bot for Dan Carpenter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox