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

Commit 0c4a0666 authored by John Dias's avatar John Dias Committed by Lingutla Chandrasekhar
Browse files

sched: walt: fix out-of-bounds access



A computation in update_top_tasks() is indexing
off the end of a top_tasks array. There's code
to limit the index in the computation, but it's
insufficient.

Bug: 110529282
Change-Id: Idb5ff5e5800c014394bcb04638844bf1e057a40c
Signed-off-by: default avatarJohn Dias <joaodias@google.com>
Signed-off-by: default avatarLingutla Chandrasekhar <clingutla@codeaurora.org>
parent 6beeaa5c
Loading
Loading
Loading
Loading
+4 −7
Original line number Diff line number Diff line
@@ -701,14 +701,11 @@ static inline void inter_cluster_migration_fixup
	BUG_ON((s64)src_rq->nt_curr_runnable_sum < 0);
}

static int load_to_index(u32 load)
static u32 load_to_index(u32 load)
{
	if (load < sched_load_granule)
		return 0;
	else if (load >= sched_ravg_window)
		return NUM_LOAD_INDICES - 1;
	else
		return load / sched_load_granule;
	u32 index = load / sched_load_granule;

	return min(index, (u32)(NUM_LOAD_INDICES - 1));
}

static void