Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit dceccc6a authored by Neil Leeder's avatar Neil Leeder
Browse files

msm: perf: fix potential memory errors



Guard against potential null pointer dereference and out
of bounds array access.

Change-Id: I8d579537a9bb6514e6bbdc4e0d60a9e0446bd244
Signed-off-by: default avatarNeil Leeder <nleeder@codeaurora.org>
parent 2f0d7b70
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -455,7 +455,7 @@ static void __ref multicore_free_irq(int irq, void *dev_id)
	int cpu;
	struct irq_desc *desc = irq_to_desc(irq);

	if (irq >= 0) {
	if ((irq >= 0) && desc) {
		for_each_cpu(cpu, desc->percpu_enabled) {
			if (!armpmu_cpu_up(cpu))
				smp_call_function_single(cpu,
+2 −1
Original line number Diff line number Diff line
@@ -46,6 +46,7 @@ u32 evt_type_base[4] = {0xcc, 0xd0, 0xd4, 0xd8};
#define VENUM_BASE_OFFSET 3

#define KRAIT_MAX_L1_REG 3
#define KRAIT_MAX_VENUM_REG 0

/*
 * Every 4 bytes represents a prefix.
@@ -214,7 +215,7 @@ static unsigned int get_krait_evtinfo(unsigned int krait_evt_type,
		return -EINVAL;

	if (prefix == KRAIT_VENUMEVT_PREFIX) {
		if (code & 0xe0)
		if ((code & 0xe0) || (reg > KRAIT_MAX_VENUM_REG))
			return -EINVAL;
		else
			reg += VENUM_BASE_OFFSET;