Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1444594 > unrolled thread

[patch 1/2] perf jit: add missing curly braces

Started byDan Carpenter <dan.carpenter@oracle.com>
First post2016-07-15 23:10 +0200
Last post2016-07-19 09:00 +0200
Articles 5 — 4 participants

Back to article view | Back to linux.kernel


Contents

  [patch 1/2] perf jit: add missing curly braces Dan Carpenter <dan.carpenter@oracle.com> - 2016-07-15 23:10 +0200
    Re: [patch 1/2] perf jit: add missing curly braces Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-07-16 00:30 +0200
    Re: [patch 1/2] perf jit: add missing curly braces Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-07-16 00:30 +0200
    Re: [patch 1/2] perf jit: add missing curly braces Stephane Eranian <eranian@google.com> - 2016-07-16 18:40 +0200
    [tip:perf/core] perf jit: Add missing curly braces tip-bot for Dan Carpenter <tipbot@zytor.com> - 2016-07-19 09:00 +0200

#1444594 — [patch 1/2] perf jit: add missing curly braces

FromDan Carpenter <dan.carpenter@oracle.com>
Date2016-07-15 23:10 +0200
Subject[patch 1/2] perf jit: add missing curly braces
Message-ID<rViwV-3rh-19@gated-at.bofh.it>
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;

[toc] | [next] | [standalone]


#1444642

FromArnaldo Carvalho de Melo <acme@kernel.org>
Date2016-07-16 00:30 +0200
Message-ID<rVjMm-47e-3@gated-at.bofh.it>
In reply to#1444594
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;

[toc] | [prev] | [next] | [standalone]


#1444651

FromArnaldo Carvalho de Melo <acme@kernel.org>
Date2016-07-16 00:30 +0200
Message-ID<rVjMm-47e-5@gated-at.bofh.it>
In reply to#1444594
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;

[toc] | [prev] | [next] | [standalone]


#1444884

FromStephane Eranian <eranian@google.com>
Date2016-07-16 18:40 +0200
Message-ID<rVANc-665-21@gated-at.bofh.it>
In reply to#1444594
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;

[toc] | [prev] | [next] | [standalone]


#1446085 — [tip:perf/core] perf jit: Add missing curly braces

Fromtip-bot for Dan Carpenter <tipbot@zytor.com>
Date2016-07-19 09:00 +0200
Subject[tip:perf/core] perf jit: Add missing curly braces
Message-ID<rWxay-FB-37@gated-at.bofh.it>
In reply to#1444594
Commit-ID:  e03141db361399619f9ee97e00d4c6fe2b472104
Gitweb:     http://git.kernel.org/tip/e03141db361399619f9ee97e00d4c6fe2b472104
Author:     Dan Carpenter <dan.carpenter@oracle.com>
AuthorDate: Sat, 16 Jul 2016 00:07:12 +0300
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Mon, 18 Jul 2016 12:20:00 -0300

perf jit: Add missing curly braces

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>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: kernel-janitors@vger.kernel.org
Link: http://lkml.kernel.org/r/20160715210712.GA19522@mwanda
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/jvmti/jvmti_agent.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

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;

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web