kernel-janitors.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch 1/2] perf jit: add missing curly braces
@ 2016-07-15 21:07 Dan Carpenter
  2016-07-15 22:25 ` Arnaldo Carvalho de Melo
  2016-07-16 16:30 ` Stephane Eranian
  0 siblings, 2 replies; 4+ messages in thread
From: Dan Carpenter @ 2016-07-15 21:07 UTC (permalink / raw)
  To: Peter Zijlstra, Stephane Eranian
  Cc: Ingo Molnar, Arnaldo Carvalho de Melo, Alexander Shishkin,
	Adrian Hunter, linux-kernel, kernel-janitors

It doesn't change the runtime behavior, but my static checker complains
that curly braces were intended.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/tools/perf/jvmti/jvmti_agent.c b/tools/perf/jvmti/jvmti_agent.c
index 3573f31..91bf333 100644
--- a/tools/perf/jvmti/jvmti_agent.c
+++ b/tools/perf/jvmti/jvmti_agent.c
@@ -491,10 +491,11 @@ jvmti_write_debug_info(void *agent, uint64_t code, const char *file,
 		if (sret != 1)
 			goto error;
 	}
-	if (padding_count)
+	if (padding_count) {
 		sret = fwrite_unlocked(pad_bytes, padding_count, 1, fp);
 		if (sret != 1)
 			goto error;
+	}
 
 	funlockfile(fp);
 	return 0;

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

* Re: [patch 1/2] perf jit: add missing curly braces
  2016-07-15 21:07 [patch 1/2] perf jit: add missing curly braces Dan Carpenter
@ 2016-07-15 22:25 ` Arnaldo Carvalho de Melo
  2016-07-15 22:27   ` Arnaldo Carvalho de Melo
  2016-07-16 16:30 ` Stephane Eranian
  1 sibling, 1 reply; 4+ messages in thread
From: Arnaldo Carvalho de Melo @ 2016-07-15 22:25 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Peter Zijlstra, Stephane Eranian, Ingo Molnar, Alexander Shishkin,
	Adrian Hunter, linux-kernel, kernel-janitors

Em Sat, Jul 16, 2016 at 12:07:12AM +0300, Dan Carpenter escreveu:
> It doesn't change the runtime behavior, but my static checker complains
> that curly braces were intended.

Agreed, applying, thanks!

- Arnaldo
 
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> 
> diff --git a/tools/perf/jvmti/jvmti_agent.c b/tools/perf/jvmti/jvmti_agent.c
> index 3573f31..91bf333 100644
> --- a/tools/perf/jvmti/jvmti_agent.c
> +++ b/tools/perf/jvmti/jvmti_agent.c
> @@ -491,10 +491,11 @@ jvmti_write_debug_info(void *agent, uint64_t code, const char *file,
>  		if (sret != 1)
>  			goto error;
>  	}
> -	if (padding_count)
> +	if (padding_count) {
>  		sret = fwrite_unlocked(pad_bytes, padding_count, 1, fp);
>  		if (sret != 1)
>  			goto error;
> +	}
>  
>  	funlockfile(fp);
>  	return 0;

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

* Re: [patch 1/2] perf jit: add missing curly braces
  2016-07-15 22:25 ` Arnaldo Carvalho de Melo
@ 2016-07-15 22:27   ` Arnaldo Carvalho de Melo
  0 siblings, 0 replies; 4+ messages in thread
From: Arnaldo Carvalho de Melo @ 2016-07-15 22:27 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Peter Zijlstra, Stephane Eranian, Ingo Molnar, Alexander Shishkin,
	Adrian Hunter, linux-kernel, kernel-janitors

Em Fri, Jul 15, 2016 at 07:25:56PM -0300, Arnaldo Carvalho de Melo escreveu:
> Em Sat, Jul 16, 2016 at 12:07:12AM +0300, Dan Carpenter escreveu:
> > It doesn't change the runtime behavior, but my static checker complains
> > that curly braces were intended.
> 
> Agreed, applying, thanks!

After fixing this:

[acme@jouet linux]$ am /wb/1.patch 
Applying: perf jit: add missing curly braces
fatal: patch with only garbage at line 3
Patch failed at 0001 perf jit: add missing curly braces
 
> - Arnaldo
>  
> > Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> > 
> > diff --git a/tools/perf/jvmti/jvmti_agent.c b/tools/perf/jvmti/jvmti_agent.c
> > index 3573f31..91bf333 100644
> > --- a/tools/perf/jvmti/jvmti_agent.c
> > +++ b/tools/perf/jvmti/jvmti_agent.c
> > @@ -491,10 +491,11 @@ jvmti_write_debug_info(void *agent, uint64_t code, const char *file,
> >  		if (sret != 1)
> >  			goto error;
> >  	}
> > -	if (padding_count)
> > +	if (padding_count) {
> >  		sret = fwrite_unlocked(pad_bytes, padding_count, 1, fp);
> >  		if (sret != 1)
> >  			goto error;
> > +	}
> >  
> >  	funlockfile(fp);
> >  	return 0;

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

* Re: [patch 1/2] perf jit: add missing curly braces
  2016-07-15 21:07 [patch 1/2] perf jit: add missing curly braces Dan Carpenter
  2016-07-15 22:25 ` Arnaldo Carvalho de Melo
@ 2016-07-16 16:30 ` Stephane Eranian
  1 sibling, 0 replies; 4+ messages in thread
From: Stephane Eranian @ 2016-07-16 16:30 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
	Alexander Shishkin, Adrian Hunter, LKML, kernel-janitors

On Fri, Jul 15, 2016 at 2:07 PM, Dan Carpenter <dan.carpenter@oracle.com> wrote:
> It doesn't change the runtime behavior, but my static checker complains
> that curly braces were intended.
>
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
>
This was clearly a bug. It did not fire when padding=0 because you
never come out of the loop with sret != 0.
If padding=0, then you execute the fwrite() and then the sret test is
just after, so this was working but I agree
this was not the intended code flow.
Thanks for tracking this down.

> diff --git a/tools/perf/jvmti/jvmti_agent.c b/tools/perf/jvmti/jvmti_agent.c
> index 3573f31..91bf333 100644
> --- a/tools/perf/jvmti/jvmti_agent.c
> +++ b/tools/perf/jvmti/jvmti_agent.c
> @@ -491,10 +491,11 @@ jvmti_write_debug_info(void *agent, uint64_t code, const char *file,
>                 if (sret != 1)
>                         goto error;
>         }
> -       if (padding_count)
> +       if (padding_count) {
>                 sret = fwrite_unlocked(pad_bytes, padding_count, 1, fp);
>                 if (sret != 1)
>                         goto error;
> +       }
>
>         funlockfile(fp);
>         return 0;

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

end of thread, other threads:[~2016-07-16 16:30 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-07-15 21:07 [patch 1/2] perf jit: add missing curly braces Dan Carpenter
2016-07-15 22:25 ` Arnaldo Carvalho de Melo
2016-07-15 22:27   ` Arnaldo Carvalho de Melo
2016-07-16 16:30 ` Stephane Eranian

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