Re: [PATCH] Fix Java profiling regression bug from Aug 13 Coverity fixes
Maynard Johnson <[email protected]>
| Newsgroups | gmane.linux.oprofile |
|---|---|
| Message-ID | <[email protected]> |
On 08/26/2014 11:58 AM, Maynard Johnson wrote: > Fix Java profiling regression bug from Aug 13 Coverity fixes > > One of the changes made in the Aug 13 commit to fix issues > identified by Coverity caused a regression in oprofile's JIT > support. The libopagent.so (used by libjvm[t|p]i.so) may incorrectly > return an error from the op_write_native_code function. This patch > fixes that issue. > > Signed-off-by: Maynard Johnson <[email protected]> Patch applied. -Maynard > --- > libopagent/opagent.c | 13 +++++++++---- > 1 files changed, 9 insertions(+), 4 deletions(-) > > diff --git a/libopagent/opagent.c b/libopagent/opagent.c > index f567f9e..431dfae 100644 > --- a/libopagent/opagent.c > +++ b/libopagent/opagent.c > @@ -374,17 +374,22 @@ again: > */ > if (fwrite_unlocked(&rec, sizeof(rec), 1, dumpfile) && > fwrite_unlocked(symbol_name, sz_symb_name, 1, dumpfile)) { > - size_t sz = 0; > - if (code) > + size_t expected_sz, sz; > + expected_sz = sz = 0; > + if (code) { > sz = fwrite_unlocked(code, size, 1, dumpfile); > - if (padding_count) > + expected_sz++; > + } > + if (padding_count) { > sz += fwrite_unlocked(pad_bytes, padding_count, 1, dumpfile); > + expected_sz++; > + } > /* Always flush to ensure conversion code to elf will see > * data as soon as possible */ > fflush_unlocked(dumpfile); > funlockfile(dumpfile); > flock(dumpfd, LOCK_UN); > - if (sz != 2) { > + if (sz != expected_sz) { > printf("opagent: fwrite_unlocked failed"); > return -1; > } > ------------------------------------------------------------------------------ Slashdot TV. Video for Nerds. Stuff that matters. http://tv.slashdot.org/