All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] x86: mark compat hypercall regs clobbering for intended fall-through
@ 2021-07-13  8:08 Jan Beulich
  2021-08-18  9:16 ` Andrew Cooper
  0 siblings, 1 reply; 2+ messages in thread
From: Jan Beulich @ 2021-07-13  8:08 UTC (permalink / raw)
  To: xen-devel; +Cc: Andrew Cooper, Wei Liu, Roger Pau Monné

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@suse.com>
---
I have to admit that I really have trouble spotting a pattern in what
Coverity spots or does not spot.

--- 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 *
         /* 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 *
             /* 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;
             }
         }
--- 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 *
         /* 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 *
             /* 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;
             }
         }



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] x86: mark compat hypercall regs clobbering for intended fall-through
  2021-07-13  8:08 [PATCH] x86: mark compat hypercall regs clobbering for intended fall-through Jan Beulich
@ 2021-08-18  9:16 ` Andrew Cooper
  0 siblings, 0 replies; 2+ messages in thread
From: Andrew Cooper @ 2021-08-18  9:16 UTC (permalink / raw)
  To: Jan Beulich, xen-devel; +Cc: Wei Liu, Roger Pau Monné

On 13/07/2021 09:08, Jan Beulich wrote:
> 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@suse.com>

Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-08-18  9:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-13  8:08 [PATCH] x86: mark compat hypercall regs clobbering for intended fall-through Jan Beulich
2021-08-18  9:16 ` Andrew Cooper

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.