[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[xen master] gnttab: fully ignore zero-size copy requests



commit a4a790f4327fd80cf4615c11cd146291b0dcc5fc
Author:     Jan Beulich <jbeulich@xxxxxxxx>
AuthorDate: Thu Feb 22 11:49:10 2024 +0100
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Thu Feb 22 11:49:10 2024 +0100

    gnttab: fully ignore zero-size copy requests
    
    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@xxxxxxxx>
    Reviewed-by: Julien Grall <jgrall@xxxxxxxxxx>
---
 xen/common/grant_table.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/xen/common/grant_table.c b/xen/common/grant_table.c
index 5721eab225..37b178a67b 100644
--- a/xen/common/grant_table.c
+++ b/xen/common/grant_table.c
@@ -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 )
     {
--
generated by git-patchbot for /home/xen/git/xen.git#master



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.