perf jit: add missing curly braces
Subsystems (2)
PATCH 1/2 perf jit: add missing curly braces
It doesn't change the runtime behavior, but my static checker complains that curly braces were intended.
tools/perf/jvmti/jvmti_agent.c +2 -1
@@ -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 ;
Arnaldo Carvalho de Melo
maintainerEm Sat, Jul 16, 2016 at 12:07:12AM +0300, Dan Carpenter escreveu:
Quoted 2 lines
It doesn't change the runtime behavior, but my static checker complains that curly braces were intended.
Agreed, applying, thanks!
- Arnaldo
Quoted 19 lines
Signed-off-by Dan Carpenter <[email protected]>tools/perf/jvmti/jvmti_agent.c +2
-1@@ -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 ;
Arnaldo Carvalho de Melo
maintainerEm Fri, Jul 15, 2016 at 07:25:56PM -0300, Arnaldo Carvalho de Melo escreveu:
Quoted 5 lines
Em Sat, Jul 16, 2016 at 12:07:12AM +0300, Dan Carpenter escreveu:
Quoted 2 lines
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
Quoted 21 lines
- Arnaldo
Quoted 19 lines
Signed-off-by Dan Carpenter <[email protected]>tools/perf/jvmti/jvmti_agent.c +2
-1@@ -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 ;
Quoted 5 lines · Dan Carpenter
It doesn't change the runtime behavior, but my static checker complains that curly braces were intended.
Signed-off-by Dan Carpenter <[email protected]>
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.
Quoted 17 lines
tools/perf/jvmti/jvmti_agent.c +2
-1@@ -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 ;
tip-bot for Dan Carpenter
merge bot[tip:perf/core] perf jit: Add missing curly braces
In reply to Dan Carpenterperf jit: Add missing curly braces
Commit-ID: e03141db361399619f9ee97e00d4c6fe2b472104 Gitweb: http://git.kernel.org/tip/e03141db361399619f9ee97e00d4c6fe2b472104 Author: Dan Carpenter <[email protected]> AuthorDate: Sat, 16 Jul 2016 00:07:12 +0300 Committer: Arnaldo Carvalho de Melo <[email protected]> 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.
--- tools/perf/jvmti/jvmti_agent.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
tools/perf/jvmti/jvmti_agent.c +2 -1
@@ -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 ;