ANDROID: KVM: arm64: Fix pKVM mod hyp events lookup

A comparison issue in hyp_trace_find_event() might lead to a wrong
resolution of event ID to the struct describing how to decode this
event.

In details, the ID starts to 0 and it should be taken into account when
jumping to the next event table. If the table has X events and our ID is
X, we need to do another jump.

Bug: 278749606
Bug: 268495982
Fixes: 78bed703d2 ("ANDROID: KVM: arm64: Allow registration of pKVM module hyp events")
Change-Id: I6f8f2701f697fc5e81eb5f48094abcaa6fecee38
Signed-off-by: Vincent Donnefort <vdonnefort@google.com>
This commit is contained in:
Vincent Donnefort 2024-07-10 17:29:43 +01:00
parent fcbb7a1d21
commit 885dc76e19

View File

@ -278,7 +278,7 @@ struct hyp_event *hyp_trace_find_event(int id)
table = rcu_dereference(mod_event_tables.tables);
for (int i = 0; i < mod_event_tables.nr_tables; i++) {
if (table->nr_events < id) {
if (table->nr_events <= id) {
id -= table->nr_events;
table++;
continue;