On 13/8/25 16:17, Steve Sistare wrote:
Set an error message if vfio_cpr_ram_discard_register_listener fails so
the fail label gets a valid error object.
Reported-by: Cédric Le Goater <c...@redhat.com>
Fixes: eba1f657cbb1 ("vfio/container: recover from unmap-all-vaddr failure")
Signed-off-by: Steve Sistare <steven.sist...@oracle.com>
---
hw/vfio/listener.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/hw/vfio/listener.c b/hw/vfio/listener.c
index f498e23..5ebafaa 100644
--- a/hw/vfio/listener.c
+++ b/hw/vfio/listener.c
@@ -574,6 +574,9 @@ void vfio_container_region_add(VFIOContainerBase
*bcontainer,
vfio_ram_discard_register_listener(bcontainer, section);
} else if (!vfio_cpr_ram_discard_register_listener(bcontainer,
section)) {
Looking at commit 8947d7fc4e7 ("memory: Introduce RamDiscardManager for
RAM memory regions"):
typedef int (*NotifyRamPopulate)(RamDiscardListener *rdl,
MemoryRegionSection *section);
/*
* @notify_populate:
*
* Notification that previously discarded memory is about to get
* populated.
* Listeners are able to object. If any listener objects, already
* successfully notified listeners are notified about a discard
* again.
*
* @rdl: the #RamDiscardListener getting notified
* @section: the #MemoryRegionSection to get populated. The section
* is aligned within the memory region to the minimum
* granularity unless it would exceed the registered
* section.
*
* Returns 0 on success. If the notification is rejected by the
* listener, an error is returned.
*/
NotifyRamPopulate notify_populate;
Not sure what error is returned by this prototype (errno?), but if what
error is not relevant, maybe it should take an Error** parameter and
return a boolean value instead.