]> git.baikalelectronics.ru Git - kernel.git/commit
powerpc/perf/hv-24x7: Properly iterate through results
authorThiago Jung Bauermann <bauerman@linux.vnet.ibm.com>
Thu, 29 Jun 2017 21:55:33 +0000 (18:55 -0300)
committerMichael Ellerman <mpe@ellerman.id.au>
Sun, 2 Jul 2017 10:40:30 +0000 (20:40 +1000)
commit0b1db9361de35ccae6e75ef57a92faf75b97271d
tree7e32d574bd59169a6daabd5d3e5a93ebad36f9b7
parentc41d3a24d9bbdc7c25208d2b59e34a51088c42c0
powerpc/perf/hv-24x7: Properly iterate through results

hv-24x7.h has a comment mentioning that result_buffer->results can't be
indexed as a normal array because it may contain results of variable sizes,
so fix the loop in h_24x7_event_commit_txn to take the variation into
account when iterating through results.

Another problem in that loop is that it sets h24x7hw->events[i] to NULL.
This assumes that only the i'th result maps to the i'th request, but that
is not guaranteed to be true. We need to leave the event in the array so
that we don't dereference a NULL pointer in case more than one result maps
to one request.

We still assume that each result has only one result element, so warn if
that assumption is violated.

Reviewed-by: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
Signed-off-by: Thiago Jung Bauermann <bauerman@linux.vnet.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
arch/powerpc/perf/hv-24x7.c