mirror of
https://github.com/riscv-software-src/opensbi.git
synced 2026-11-20 10:32:19 +00:00
lib: utils: mpxy: Fix RPMI service ID lookup
mpxy_find_rpmi_srvid() incorrectly used the current service ID to
control iteration through the service table. This could stop the
search prematurely or read beyond the table.
Bound the search using num_services so every registered service is
checked without accessing entries past the end of the array.
Fixes: c5a8b15e39 ("lib: utils/mpxy: Add RPMI client driver for MPXY")
Reviewed-by: Rahul Pathak <rahul.pathak@oss.qualcomm.com>
Reviewed-by: Anup Patel <anup@brainfault.org>
Signed-off-by: Oza Pawandeep <pawandeep.oza@oss.qualcomm.com>
Link: https://lore.kernel.org/r/20261118215549.2499040-7-pawandeep.oza@oss.qualcomm.com
Signed-off-by: Anup Patel <anup@brainfault.org>
This commit is contained in:
1 parent
894ca389b4
commit
bd873ab56a
1 file changed
+1
-1
@@ -76,7 +76,7 @@ static const struct mpxy_rpmi_service_data *mpxy_find_rpmi_srvid(u32 message_id,
|
|||||||
const struct mpxy_rpmi_service_data *srv = data->service_data;
|
const struct mpxy_rpmi_service_data *srv = data->service_data;
|
||||||
int mid = 0;
|
int mid = 0;
|
||||||
|
|
||||||
for (mid = 0; srv[mid].id < data->num_services; mid++) {
|
for (mid = 0; mid < data->num_services; mid++) {
|
||||||
if (srv[mid].id == (u8)message_id)
|
if (srv[mid].id == (u8)message_id)
|
||||||
return &srv[mid];
|
return &srv[mid];
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user