mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-08 11:50:43 +09:00
powerpc/perf: Return accordingly on invalid chip-id in
[ Upstream commita913e5e8b4] 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 <dan.carpenter@oracle.com> Fixes:885dcd709b("powerpc/perf: Add nest IMC PMU support") Reviewed-by: Madhavan Srinivasan <maddy@linux.vnet.ibm.com> Signed-off-by: Anju T Sudhakar <anju@linux.vnet.ibm.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
49c0fa1f35
commit
741853944f
@@ -496,6 +496,11 @@ static int nest_imc_event_init(struct perf_event *event)
|
||||
* Get the base memory addresss for this cpu.
|
||||
*/
|
||||
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) {
|
||||
|
||||
Reference in New Issue
Block a user