From: Borislav Petkov Date: Tue, 23 Feb 2021 11:03:19 +0000 (+0100) Subject: x86/sev-es: Remove subtraction of res variable X-Git-Tag: accepted/tizen/unified/20230118.172025~7436^2~11 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f3db3365c069c2a8505cdee8033fe3d22d2fe6c0;p=platform%2Fkernel%2Flinux-rpi.git x86/sev-es: Remove subtraction of res variable vc_decode_insn() calls copy_from_kernel_nofault() by way of vc_fetch_insn_kernel() to fetch 15 bytes max of opcodes to decode. copy_from_kernel_nofault() returns negative on error and 0 on success. The error case is handled by returning ES_EXCEPTION. In the success case, the ret variable which contains the return value is 0 so there's no need to subtract it from MAX_INSN_SIZE when initializing the insn buffer for further decoding. Remove it. No functional changes. Signed-off-by: Borislav Petkov Reviewed-by: Joerg Roedel Link: https://lkml.kernel.org/r/20210223111130.16201-1-bp@alien8.de --- diff --git a/arch/x86/kernel/sev-es.c b/arch/x86/kernel/sev-es.c index 84c1821..1e78f4b 100644 --- a/arch/x86/kernel/sev-es.c +++ b/arch/x86/kernel/sev-es.c @@ -267,7 +267,7 @@ static enum es_result vc_decode_insn(struct es_em_ctxt *ctxt) return ES_EXCEPTION; } - insn_init(&ctxt->insn, buffer, MAX_INSN_SIZE - res, 1); + insn_init(&ctxt->insn, buffer, MAX_INSN_SIZE, 1); insn_get_length(&ctxt->insn); }