From: Anju T Sudhakar <hidden> Date: 2018-11-27 08:27:01
The data structure (i.e struct imc_mem_info) to hold the memory address
information for nest imc units is allocated based on the number of nodes
in the system.
nest_imc_event_init() traverse this struct array to calculate the memory
base address for the event-cpu. If we fail to find a match for the event
cpu's chip-id in imc_mem_info struct array, then the do-while loop will
iterate until we crash.
Fix this by changing the loop exit condition based on the number of
nodes in the system.
Reported-by: Dan Carpenter <redacted>
Fixes: 885dcd709ba91 ( powerpc/perf: Add nest IMC PMU support)
Signed-off-by: Anju T Sudhakar <redacted>
---
arch/powerpc/perf/imc-pmu.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
From: Anju T Sudhakar <hidden> Date: 2018-11-27 08:28:53
Nest hardware counter memory resides in a per-chip reserve-memory.
During nest_imc_event_init(), chip-id of the event-cpu is considered to
calculate the base memory addresss for that cpu. Return, proper error
condition if the chip_id calculated is invalid.
Reported-by: Dan Carpenter <redacted>
Fixes: 885dcd709ba91 ("powerpc/perf: Add nest IMC PMU support")
Reviewed-by: Madhavan Srinivasan <redacted>
Signed-off-by: Anju T Sudhakar <redacted>
---
arch/powerpc/perf/imc-pmu.c | 5 +++++
1 file changed, 5 insertions(+)
@@ -496,6 +496,11 @@ static int nest_imc_event_init(struct perf_event *event)*Getthebasememoryaddresssforthiscpu.*/chip_id=cpu_to_chip_id(event->cpu);++/* Return, if chip_id is not valid */+if(chip_id<0)+return-ENODEV;+pcni=pmu->mem_info;do{if(pcni->id==chip_id){
From: Michael Ellerman <hidden> Date: 2019-05-03 07:01:51
On Tue, 2018-11-27 at 08:24:52 UTC, Anju T Sudhakar wrote:
Nest hardware counter memory resides in a per-chip reserve-memory.
During nest_imc_event_init(), chip-id of the event-cpu is considered to
calculate the base memory addresss for that cpu. Return, proper error
condition if the chip_id calculated is invalid.
Reported-by: Dan Carpenter <redacted>
Fixes: 885dcd709ba91 ("powerpc/perf: Add nest IMC PMU support")
Reviewed-by: Madhavan Srinivasan <redacted>
Signed-off-by: Anju T Sudhakar <redacted>