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

[xen master] x86: mark compat hypercall regs clobbering for intended fall-through



commit dd635cebd1eefc7f90bbe3d5df2524a2a3a94f88
Author:     Jan Beulich <jbeulich@xxxxxxxx>
AuthorDate: Thu Aug 19 13:36:54 2021 +0200
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Thu Aug 19 13:36:54 2021 +0200

    x86: mark compat hypercall regs clobbering for intended fall-through
    
    Oddly enough in the original report Coverity only complained about the
    native hypercall related switch() statements. Now that it has seen those
    fixed, it complains about (only HVM) compat ones. Hence the CIDs below
    are all for the HVM side of things, yet while at it take care of the PV
    side as well.
    
    Coverity-ID: 1487105, 1487106, 1487107, 1487108, 1487109.
    Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
    Acked-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
---
 xen/arch/x86/hvm/hypercall.c | 20 ++++++++++----------
 xen/arch/x86/pv/hypercall.c  | 20 ++++++++++----------
 2 files changed, 20 insertions(+), 20 deletions(-)

diff --git a/xen/arch/x86/hvm/hypercall.c b/xen/arch/x86/hvm/hypercall.c
index 263d5407ea..261d8ee8a4 100644
--- a/xen/arch/x86/hvm/hypercall.c
+++ b/xen/arch/x86/hvm/hypercall.c
@@ -292,11 +292,11 @@ int hvm_hypercall(struct cpu_user_regs *regs)
         /* Deliberately corrupt parameter regs not used by this hypercall. */
         switch ( hypercall_args_table[eax].compat )
         {
-        case 0: ebx = 0xdeadf00d;
-        case 1: ecx = 0xdeadf00d;
-        case 2: edx = 0xdeadf00d;
-        case 3: esi = 0xdeadf00d;
-        case 4: edi = 0xdeadf00d;
+        case 0: ebx = 0xdeadf00d; fallthrough;
+        case 1: ecx = 0xdeadf00d; fallthrough;
+        case 2: edx = 0xdeadf00d; fallthrough;
+        case 3: esi = 0xdeadf00d; fallthrough;
+        case 4: edi = 0xdeadf00d; fallthrough;
         case 5: ebp = 0xdeadf00d;
         }
 #endif
@@ -312,11 +312,11 @@ int hvm_hypercall(struct cpu_user_regs *regs)
             /* Deliberately corrupt parameter regs used by this hypercall. */
             switch ( hypercall_args_table[eax].compat )
             {
-            case 6: regs->rbp = 0xdeadf00d;
-            case 5: regs->rdi = 0xdeadf00d;
-            case 4: regs->rsi = 0xdeadf00d;
-            case 3: regs->rdx = 0xdeadf00d;
-            case 2: regs->rcx = 0xdeadf00d;
+            case 6: regs->rbp = 0xdeadf00d; fallthrough;
+            case 5: regs->rdi = 0xdeadf00d; fallthrough;
+            case 4: regs->rsi = 0xdeadf00d; fallthrough;
+            case 3: regs->rdx = 0xdeadf00d; fallthrough;
+            case 2: regs->rcx = 0xdeadf00d; fallthrough;
             case 1: regs->rbx = 0xdeadf00d;
             }
         }
diff --git a/xen/arch/x86/pv/hypercall.c b/xen/arch/x86/pv/hypercall.c
index 03939bdfcf..9765e674cf 100644
--- a/xen/arch/x86/pv/hypercall.c
+++ b/xen/arch/x86/pv/hypercall.c
@@ -197,11 +197,11 @@ void pv_hypercall(struct cpu_user_regs *regs)
         /* Deliberately corrupt parameter regs not used by this hypercall. */
         switch ( hypercall_args_table[eax].compat )
         {
-        case 0: ebx = 0xdeadf00d;
-        case 1: ecx = 0xdeadf00d;
-        case 2: edx = 0xdeadf00d;
-        case 3: esi = 0xdeadf00d;
-        case 4: edi = 0xdeadf00d;
+        case 0: ebx = 0xdeadf00d; fallthrough;
+        case 1: ecx = 0xdeadf00d; fallthrough;
+        case 2: edx = 0xdeadf00d; fallthrough;
+        case 3: esi = 0xdeadf00d; fallthrough;
+        case 4: edi = 0xdeadf00d; fallthrough;
         case 5: ebp = 0xdeadf00d;
         }
 #endif
@@ -223,11 +223,11 @@ void pv_hypercall(struct cpu_user_regs *regs)
             /* Deliberately corrupt parameter regs used by this hypercall. */
             switch ( hypercall_args_table[eax].compat )
             {
-            case 6: regs->ebp = 0xdeadf00d;
-            case 5: regs->edi = 0xdeadf00d;
-            case 4: regs->esi = 0xdeadf00d;
-            case 3: regs->edx = 0xdeadf00d;
-            case 2: regs->ecx = 0xdeadf00d;
+            case 6: regs->ebp = 0xdeadf00d; fallthrough;
+            case 5: regs->edi = 0xdeadf00d; fallthrough;
+            case 4: regs->esi = 0xdeadf00d; fallthrough;
+            case 3: regs->edx = 0xdeadf00d; fallthrough;
+            case 2: regs->ecx = 0xdeadf00d; fallthrough;
             case 1: regs->ebx = 0xdeadf00d;
             }
         }
--
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®.