From: "Jan Beulich" Subject: [PATCH v2 1/3] use consistent exit mechanism Date: Mon, 04 Jul 2016 05:55:08 -0600 Message-ID: <577A6ABC02000078000FAD04@prv-mh.provo.novell.com> References: <577A69E502000078000FACED@prv-mh.provo.novell.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=__Part87B1A78C.1__=" Return-path: Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bK2T5-0005SW-2e for xen-devel@lists.xenproject.org; Mon, 04 Jul 2016 11:55:15 +0000 In-Reply-To: <577A69E502000078000FACED@prv-mh.provo.novell.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" To: xen-devel Cc: Andrew Cooper List-Id: xen-devel@lists.xenproject.org This is a MIME message. If you are reading this text, you may want to consider changing to a mail reader or gateway that understands how to properly handle MIME multipart messages. --=__Part87B1A78C.1__= Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Similar code should use similar exit mechanisms (return vs goto). Signed-off-by: Jan Beulich --- v2: Use "goto" instead of "return", making things consistent right away instead of only after a (series of) future patch(es) converting more code to "return". --- a/xen/arch/x86/x86_emulate/x86_emulate.c +++ b/xen/arch/x86/x86_emulate/x86_emulate.c @@ -2106,7 +2106,7 @@ x86_emulate( generate_exception_if(mode_64bit() && !ext, EXC_UD, -1); fail_if(ops->read_segment =3D=3D NULL); if ( (rc =3D ops->read_segment(src.val, ®, ctxt)) !=3D 0 ) - return rc; + goto done; /* 64-bit mode: PUSH defaults to a 64-bit operand. */ if ( mode_64bit() && (op_bytes =3D=3D 4) ) op_bytes =3D 8; @@ -2125,10 +2125,9 @@ x86_emulate( if ( mode_64bit() && (op_bytes =3D=3D 4) ) op_bytes =3D 8; if ( (rc =3D read_ulong(x86_seg_ss, sp_post_inc(op_bytes), - &dst.val, op_bytes, ctxt, ops)) !=3D 0 ) + &dst.val, op_bytes, ctxt, ops)) !=3D 0 || + (rc =3D load_seg(src.val, dst.val, 0, NULL, ctxt, ops)) !=3D = 0 ) goto done; - if ( (rc =3D load_seg(src.val, dst.val, 0, NULL, ctxt, ops)) !=3D = 0 ) - return rc; break; =20 case 0x0e: /* push %%cs */ --=__Part87B1A78C.1__= Content-Type: text/plain; name="x86emul-consistently-bail.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="x86emul-consistently-bail.patch" x86emul: use consistent exit mechanism=0A=0ASimilar code should use = similar exit mechanisms (return vs goto).=0A=0ASigned-off-by: Jan Beulich = =0A---=0Av2: Use "goto" instead of "return", making = things consistent right away=0A instead of only after a (series of) = future patch(es) converting=0A more code to "return".=0A=0A--- = a/xen/arch/x86/x86_emulate/x86_emulate.c=0A+++ b/xen/arch/x86/x86_emulate/x= 86_emulate.c=0A@@ -2106,7 +2106,7 @@ x86_emulate(=0A generate_excep= tion_if(mode_64bit() && !ext, EXC_UD, -1);=0A fail_if(ops->read_seg= ment =3D=3D NULL);=0A if ( (rc =3D ops->read_segment(src.val, = ®, ctxt)) !=3D 0 )=0A- return rc;=0A+ goto = done;=0A /* 64-bit mode: PUSH defaults to a 64-bit operand. */=0A = if ( mode_64bit() && (op_bytes =3D=3D 4) )=0A op_bytes = =3D 8;=0A@@ -2125,10 +2125,9 @@ x86_emulate(=0A if ( mode_64bit() = && (op_bytes =3D=3D 4) )=0A op_bytes =3D 8;=0A if ( = (rc =3D read_ulong(x86_seg_ss, sp_post_inc(op_bytes),=0A- = &dst.val, op_bytes, ctxt, ops)) !=3D 0 )=0A+ = &dst.val, op_bytes, ctxt, ops)) !=3D 0 ||=0A+ (rc = =3D load_seg(src.val, dst.val, 0, NULL, ctxt, ops)) !=3D 0 )=0A = goto done;=0A- if ( (rc =3D load_seg(src.val, dst.val, 0, NULL, = ctxt, ops)) !=3D 0 )=0A- return rc;=0A break;=0A =0A = case 0x0e: /* push %%cs */=0A --=__Part87B1A78C.1__= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KWGVuLWRldmVs IG1haWxpbmcgbGlzdApYZW4tZGV2ZWxAbGlzdHMueGVuLm9yZwpodHRwOi8vbGlzdHMueGVuLm9y Zy94ZW4tZGV2ZWwK --=__Part87B1A78C.1__=--