Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp904782pxf; Wed, 7 Apr 2021 14:40:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw3VPtX3lFVGtLIF8dokfD3eLvCSdkA8szpPUrxQK1M9X6KRbPCXPyVrXjbTYqrqhsKJxuC X-Received: by 2002:a62:140c:0:b029:22b:6774:961b with SMTP id 12-20020a62140c0000b029022b6774961bmr4821235pfu.43.1617831633409; Wed, 07 Apr 2021 14:40:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617831633; cv=none; d=google.com; s=arc-20160816; b=z4lJc3mrGl/KGQLT7Pa4XZU0w0hIzRP/Og77ne3N3SeKHmSVwEMJoqnHY2eDTtP+iE M9tojmckFStB3fnQjq3QizbaOukaiGbe35azyyHEjtEfHxqrPOwZZZwhfoBDr5taj8Lk oUrcjAHULh5VZg2wsAMPpdY99ZUK3dC3vgw+xoxMSlAmpNNpI23QTnuNP+jd9aizQUWc 6vtAAz4nAGFV1yb1oIswuYYL9r0jZ/Hk+FZt5xyFwNrNH+Grr35IFF9aBHmfY0r65Pta 0CUiU5FzNjvHI/KodfhRhyZcmYMTXfp6MFlAOS5FzE35fdfDUhCnBGZCMJ/cjSao5kMV D4WQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=OZSr4QEhdVL92d88OkNHt7USbVvwKLHf2gIT9PFm3VE=; b=p0h016HixUuIFzpytTMnhz46if8kiS7xCqAJ5OAS7OLutVRAUqvR23VCqqtE1c5eRA OS2mleVJjNtjj1v2WOd6HBFt0m7/4NpFgZPbwTE6k4TSbiOHK4d2LfcjrL8Qt1DiGzOE FXujkPHj2X57iTqLlb3YvJn37C5uDI5A6H2i3LmzHFiM32YykruPovI8m1m+Px0+wKns OJTyxjJDBM7EHA1vMZAg0jkK+sm0yXTWx+SPUPLNOMrozwkF+AL25YYM68CO6f6R/Gbo fmq0z0A4XmrYSqkFxCBBK322nrM9GfuQgdIRRw4WM1xNx3hGKf5FPZ88F7GurifKmbu+ T+4w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 127si24739192pgg.187.2021.04.07.14.40.20; Wed, 07 Apr 2021 14:40:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243147AbhDGRHG (ORCPT + 99 others); Wed, 7 Apr 2021 13:07:06 -0400 Received: from pegase1.c-s.fr ([93.17.236.30]:44331 "EHLO pegase1.c-s.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234050AbhDGRHF (ORCPT ); Wed, 7 Apr 2021 13:07:05 -0400 Received: from localhost (mailhub1-int [192.168.12.234]) by localhost (Postfix) with ESMTP id 4FFrR00jRRzB09ZQ; Wed, 7 Apr 2021 19:06:52 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at c-s.fr Received: from pegase1.c-s.fr ([192.168.12.234]) by localhost (pegase1.c-s.fr [192.168.12.234]) (amavisd-new, port 10024) with ESMTP id 5RNxtr6d0LwG; Wed, 7 Apr 2021 19:06:52 +0200 (CEST) Received: from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192]) by pegase1.c-s.fr (Postfix) with ESMTP id 4FFrQz6rN1zB09ZJ; Wed, 7 Apr 2021 19:06:51 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 8E54D8B7B6; Wed, 7 Apr 2021 19:06:53 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from messagerie.si.c-s.fr ([127.0.0.1]) by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023) with ESMTP id Xg2uihRRaosX; Wed, 7 Apr 2021 19:06:53 +0200 (CEST) Received: from [192.168.4.90] (unknown [192.168.4.90]) by messagerie.si.c-s.fr (Postfix) with ESMTP id C34438B75F; Wed, 7 Apr 2021 19:06:52 +0200 (CEST) Subject: Re: [PATCH v2 8/8] KVM: SVM: Allocate SEV command structures on local stack To: Sean Christopherson , Borislav Petkov Cc: Paolo Bonzini , Brijesh Singh , Tom Lendacky , John Allen , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , kvm@vger.kernel.org, linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org References: <20210406224952.4177376-1-seanjc@google.com> <20210406224952.4177376-9-seanjc@google.com> <9df3b755-d71a-bfdf-8bee-f2cd2883ea2f@csgroup.eu> <20210407102440.GA25732@zn.tnic> From: Christophe Leroy Message-ID: <24cd7d2b-3b74-6b51-aa9a-554003fe5cec@csgroup.eu> Date: Wed, 7 Apr 2021 19:06:35 +0200 User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.9.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: fr Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org Le 07/04/2021 à 19:05, Sean Christopherson a écrit : > On Wed, Apr 07, 2021, Borislav Petkov wrote: >> First of all, I'd strongly suggest you trim your emails when you reply - >> that would be much appreciated. >> >> On Wed, Apr 07, 2021 at 07:24:54AM +0200, Christophe Leroy wrote: >>>> @@ -258,7 +240,7 @@ static int sev_issue_cmd(struct kvm *kvm, int id, void *data, int *error) >>>> static int sev_launch_start(struct kvm *kvm, struct kvm_sev_cmd *argp) >>>> { >>>> struct kvm_sev_info *sev = &to_kvm_svm(kvm)->sev_info; >>>> - struct sev_data_launch_start *start; >>>> + struct sev_data_launch_start start; >>> >>> struct sev_data_launch_start start = {0, 0, 0, 0, 0, 0, 0}; >> >> I don't know how this is any better than using memset... >> >> Also, you can do >> >> ... start = { }; >> >> which is certainly the only other alternative to memset, AFAIK. >> >> But whatever you do, you need to look at the resulting asm the compiler >> generates. So let's do that: > > I'm ok with Boris' version, I'm not a fan of having to count zeros. I used > memset() to defer initialization until after the various sanity checks, and > out of habit. > Yes I also like Boris' version ... start = { }; better than mine.