firmware: arm_ffa: Fix ffa_notification_info_get() IDs handling
authorLorenzo Pieralisi <lpieralisi@kernel.org>
Wed, 8 Nov 2023 11:15:49 +0000 (12:15 +0100)
committerSudeep Holla <sudeep.holla@arm.com>
Mon, 13 Nov 2023 11:51:26 +0000 (11:51 +0000)
To parse the retrieved ID lists appropriately in
ffa_notification_info_get() the ids_processed variable should not
be pre-incremented - we are dropping an identifier at the
beginning of the list.

Fix it by using the post-increment operator to increment the number
of processed IDs.

Fixes: 3522be48d82b ("firmware: arm_ffa: Implement the NOTIFICATION_INFO_GET interface")
Signed-off-by: Lorenzo Pieralisi <lpieralisi@kernel.org>
Cc: Sudeep Holla <sudeep.holla@arm.com>
Link: https://lore.kernel.org/r/20231108111549.155974-1-lpieralisi@kernel.org
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
drivers/firmware/arm_ffa/driver.c

index 034bce8a2ca1a30b440c81110d5de4719c33641e..6146b2927d5c56af6bc3b9722c1789f29a4498fe 100644 (file)
@@ -783,7 +783,7 @@ static void ffa_notification_info_get(void)
                        if (ids_processed >= max_ids - 1)
                                break;
 
-                       part_id = packed_id_list[++ids_processed];
+                       part_id = packed_id_list[ids_processed++];
 
                        if (!ids_count[list]) { /* Global Notification */
                                __do_sched_recv_cb(part_id, 0, false);
@@ -795,7 +795,7 @@ static void ffa_notification_info_get(void)
                                if (ids_processed >= max_ids - 1)
                                        break;
 
-                               vcpu_id = packed_id_list[++ids_processed];
+                               vcpu_id = packed_id_list[ids_processed++];
 
                                __do_sched_recv_cb(part_id, vcpu_id, true);
                        }