All of lore.kernel.org
 help / color / mirror / Atom feed
From: Joerg Roedel <joro@8bytes.org>
To: Borislav Petkov <bp@alien8.de>
Cc: X86 ML <x86@kernel.org>, LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] x86/sev-es: Remove subtraction of res variable
Date: Tue, 23 Feb 2021 13:23:27 +0100	[thread overview]
Message-ID: <20210223122327.GA9649@8bytes.org> (raw)
In-Reply-To: <20210223111130.16201-1-bp@alien8.de>

On Tue, Feb 23, 2021 at 12:11:30PM +0100, Borislav Petkov wrote:
> From: Borislav Petkov <bp@suse.de>
> 
> 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 <bp@suse.de>

Reviewed-by: Joerg Roedel <jroedel@suse.de>

> ---
>  arch/x86/kernel/sev-es.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/x86/kernel/sev-es.c b/arch/x86/kernel/sev-es.c
> index 84c1821819af..1e78f4bd7bf2 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);
>  	}
>  
> -- 
> 2.29.2

  reply	other threads:[~2021-02-23 12:24 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-23 11:11 [PATCH] x86/sev-es: Remove subtraction of res variable Borislav Petkov
2021-02-23 12:23 ` Joerg Roedel [this message]
2021-03-01 12:07 ` [tip: x86/seves] " tip-bot2 for Borislav Petkov
2021-03-06 11:25 ` tip-bot2 for Borislav Petkov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210223122327.GA9649@8bytes.org \
    --to=joro@8bytes.org \
    --cc=bp@alien8.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.