]> xenbits.xensource.com Git - people/andrewcoop/xen.git/commitdiff
gnttab: fully ignore zero-size copy requests
authorJan Beulich <jbeulich@suse.com>
Thu, 22 Feb 2024 10:49:10 +0000 (11:49 +0100)
committerJan Beulich <jbeulich@suse.com>
Thu, 22 Feb 2024 10:49:10 +0000 (11:49 +0100)
Along the line with observations in the context of XSA-448, no field in
struct gnttab_copy_ptr is relevant when no data is to be copied, much
like e.g. the pointers passed to memcpy() are irrelevant (and would
never be "validated") when the passed length is zero.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Julien Grall <jgrall@amazon.com>
xen/common/grant_table.c

index 5721eab225610b74164dd378227268a05ec1b1d7..37b178a67bf70a2a0f04b5b94dbf49beb2b58815 100644 (file)
@@ -3061,6 +3061,9 @@ static int gnttab_copy_one(const struct gnttab_copy *op,
 {
     int rc;
 
+    if ( unlikely(!op->len) )
+        return GNTST_okay;
+
     if ( !src->domain || op->source.domid != src->ptr.domid ||
          !dest->domain || op->dest.domid != dest->ptr.domid )
     {