[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <161582326641.398.12722564634275936219.tip-bot2@tip-bot2>
Date: Mon, 15 Mar 2021 15:47:46 -0000
From: "tip-bot2 for Borislav Petkov" <tip-bot2@...utronix.de>
To: linux-tip-commits@...r.kernel.org
Cc: Borislav Petkov <bp@...e.de>, x86@...nel.org,
linux-kernel@...r.kernel.org
Subject: [tip: x86/core] x86/sev-es: Convert to insn_decode()
The following commit has been merged into the x86/core branch of tip:
Commit-ID: 5e32c64bb6912bdddc05216655dd37e848b717af
Gitweb: https://git.kernel.org/tip/5e32c64bb6912bdddc05216655dd37e848b717af
Author: Borislav Petkov <bp@...e.de>
AuthorDate: Mon, 16 Nov 2020 18:21:23 +01:00
Committer: Borislav Petkov <bp@...e.de>
CommitterDate: Mon, 15 Mar 2021 11:46:40 +01:00
x86/sev-es: Convert to insn_decode()
Simplify code, no functional changes.
Signed-off-by: Borislav Petkov <bp@...e.de>
Link: https://lkml.kernel.org/r/20210304174237.31945-14-bp@alien8.de
---
arch/x86/kernel/sev-es.c | 22 ++++++++++------------
1 file changed, 10 insertions(+), 12 deletions(-)
diff --git a/arch/x86/kernel/sev-es.c b/arch/x86/kernel/sev-es.c
index 043dc2f..75c7df3 100644
--- a/arch/x86/kernel/sev-es.c
+++ b/arch/x86/kernel/sev-es.c
@@ -254,7 +254,6 @@ static int vc_fetch_insn_kernel(struct es_em_ctxt *ctxt,
static enum es_result __vc_decode_user_insn(struct es_em_ctxt *ctxt)
{
char buffer[MAX_INSN_SIZE];
- enum es_result ret;
int res;
res = insn_fetch_from_user_inatomic(ctxt->regs, buffer);
@@ -268,16 +267,16 @@ static enum es_result __vc_decode_user_insn(struct es_em_ctxt *ctxt)
if (!insn_decode_from_regs(&ctxt->insn, ctxt->regs, buffer, res))
return ES_DECODE_FAILED;
- ret = ctxt->insn.immediate.got ? ES_OK : ES_DECODE_FAILED;
-
- return ret;
+ if (ctxt->insn.immediate.got)
+ return ES_OK;
+ else
+ return ES_DECODE_FAILED;
}
static enum es_result __vc_decode_kern_insn(struct es_em_ctxt *ctxt)
{
char buffer[MAX_INSN_SIZE];
- enum es_result ret;
- int res;
+ int res, ret;
res = vc_fetch_insn_kernel(ctxt, buffer);
if (res) {
@@ -287,12 +286,11 @@ static enum es_result __vc_decode_kern_insn(struct es_em_ctxt *ctxt)
return ES_EXCEPTION;
}
- insn_init(&ctxt->insn, buffer, MAX_INSN_SIZE, 1);
- insn_get_length(&ctxt->insn);
-
- ret = ctxt->insn.immediate.got ? ES_OK : ES_DECODE_FAILED;
-
- return ret;
+ ret = insn_decode(&ctxt->insn, buffer, MAX_INSN_SIZE, INSN_MODE_64);
+ if (ret < 0)
+ return ES_DECODE_FAILED;
+ else
+ return ES_OK;
}
static enum es_result vc_decode_insn(struct es_em_ctxt *ctxt)
Powered by blists - more mailing lists