On 9/30/25 01:21, Philippe Mathieu-Daudé wrote:
flatview_translate()'s @plen argument is output-only and can be NULL.

When Xen is enabled, only update @plen_out when non-NULL.

Signed-off-by: Philippe Mathieu-Daudé <[email protected]>
---
  include/system/memory.h | 5 +++--
  system/physmem.c        | 9 +++++----
  2 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/include/system/memory.h b/include/system/memory.h
index aa85fc27a10..3e5bf3ef05e 100644
--- a/include/system/memory.h
+++ b/include/system/memory.h
@@ -2992,13 +2992,14 @@ IOMMUTLBEntry 
address_space_get_iotlb_entry(AddressSpace *as, hwaddr addr,
   * @addr: address within that address space
   * @xlat: pointer to address within the returned memory region section's
   * #MemoryRegion.
- * @len: pointer to length
+ * @plen_out: pointer to valid read/write length of the translated address.
+ *            It can be @NULL when we don't care about it.
   * @is_write: indicates the transfer direction
   * @attrs: memory attributes
   */
  MemoryRegion *flatview_translate(FlatView *fv,
                                   hwaddr addr, hwaddr *xlat,
-                                 hwaddr *len, bool is_write,
+                                 hwaddr *plen_out, bool is_write,
                                   MemTxAttrs attrs);

Renaming to plen_out is misleading, because it is used as an input as well:

-        *plen = MIN(page, *plen);
+        *plen_out = MIN(page, *plen_out);

right here.  If non-null, the input should be the access length of the caller.


r~

Reply via email to