diff mbox

[2/2] x86/pv: drop gate_op prefix in emul-gate-op.c

Message ID 20170831114506.9610-3-wei.liu2@citrix.com (mailing list archive)
State New, archived
Headers show

Commit Message

Wei Liu Aug. 31, 2017, 11:45 a.m. UTC
There is only one function gate_op_read that needs to be modified.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
---
 xen/arch/x86/pv/emul-gate-op.c | 15 +++++----------
 1 file changed, 5 insertions(+), 10 deletions(-)

Comments

Jan Beulich Aug. 31, 2017, 12:03 p.m. UTC | #1
>>> On 31.08.17 at 13:45, <wei.liu2@citrix.com> wrote:
> There is only one function gate_op_read that needs to be modified.

I'm fine with it just being read() here, but I can see this being possibly
controversial. Please double check that Andrew isn't entirely opposed
to it. An alternative suggestion would then be read_mem().

> Signed-off-by: Wei Liu <wei.liu2@citrix.com>

Acked-by: Jan Beulich <jbeulich@suse.com>
Andrew Cooper Aug. 31, 2017, 12:36 p.m. UTC | #2
On 31/08/17 13:03, Jan Beulich wrote:
>>>> On 31.08.17 at 13:45, <wei.liu2@citrix.com> wrote:
>> There is only one function gate_op_read that needs to be modified.
> I'm fine with it just being read() here, but I can see this being possibly
> controversial. Please double check that Andrew isn't entirely opposed
> to it. An alternative suggestion would then be read_mem().

I'm not opposed generally, but simply 'read' has a chance of angering
Coverity, because it has inbuilt models for most functions specified by
core standards like POSIX.

read_mem() would be better.

~Andrew
Wei Liu Aug. 31, 2017, 3:04 p.m. UTC | #3
On Thu, Aug 31, 2017 at 01:36:13PM +0100, Andrew Cooper wrote:
> On 31/08/17 13:03, Jan Beulich wrote:
> >>>> On 31.08.17 at 13:45, <wei.liu2@citrix.com> wrote:
> >> There is only one function gate_op_read that needs to be modified.
> > I'm fine with it just being read() here, but I can see this being possibly
> > controversial. Please double check that Andrew isn't entirely opposed
> > to it. An alternative suggestion would then be read_mem().
> 
> I'm not opposed generally, but simply 'read' has a chance of angering
> Coverity, because it has inbuilt models for most functions specified by
> core standards like POSIX.
> 
> read_mem() would be better.
> 

read_mem it is.
diff mbox

Patch

diff --git a/xen/arch/x86/pv/emul-gate-op.c b/xen/arch/x86/pv/emul-gate-op.c
index 0a7381a094..002fb782f2 100644
--- a/xen/arch/x86/pv/emul-gate-op.c
+++ b/xen/arch/x86/pv/emul-gate-op.c
@@ -117,12 +117,8 @@  struct gate_op_ctxt {
     bool insn_fetch;
 };
 
-static int gate_op_read(
-    enum x86_segment seg,
-    unsigned long offset,
-    void *p_data,
-    unsigned int bytes,
-    struct x86_emulate_ctxt *ctxt)
+static int read(enum x86_segment seg, unsigned long offset, void *p_data,
+                unsigned int bytes, struct x86_emulate_ctxt *ctxt)
 {
     const struct gate_op_ctxt *goc =
         container_of(ctxt, struct gate_op_ctxt, ctxt);
@@ -230,7 +226,7 @@  void pv_emulate_gate_op(struct cpu_user_regs *regs)
 
     ctxt.ctxt.addr_size = ar & _SEGMENT_DB ? 32 : 16;
     /* Leave zero in ctxt.ctxt.sp_size, as it's not needed for decoding. */
-    state = x86_decode_insn(&ctxt.ctxt, gate_op_read);
+    state = x86_decode_insn(&ctxt.ctxt, read);
     ctxt.insn_fetch = false;
     if ( IS_ERR_OR_NULL(state) )
     {
@@ -265,9 +261,8 @@  void pv_emulate_gate_op(struct cpu_user_regs *regs)
         case 3:
             ++jump;
             base = x86_insn_operand_ea(state, &seg);
-            rc = gate_op_read(seg,
-                              base + (x86_insn_opsize(state) >> 3),
-                              &opnd_sel, sizeof(opnd_sel), &ctxt.ctxt);
+            rc = read(seg, base + (x86_insn_opsize(state) >> 3),
+                      &opnd_sel, sizeof(opnd_sel), &ctxt.ctxt);
             break;
         }
         break;