All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <philmd@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Tom Lendacky" <thomas.lendacky@amd.com>,
	"Brijesh Singh" <brijesh.singh@amd.com>,
	"Eduardo Habkost" <ehabkost@redhat.com>,
	"Connor Kuehl" <ckuehl@redhat.com>,
	"Richard Henderson" <richard.henderson@linaro.org>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Philippe Mathieu-Daudé" <philmd@redhat.com>
Subject: [PATCH] target/i386/sev: Ensure sev_fw_errlist is sync with update-linux-headers
Date: Fri, 19 Feb 2021 19:01:31 +0100	[thread overview]
Message-ID: <20210219180131.2061072-1-philmd@redhat.com> (raw)

Ensure sev_fw_errlist[] is updated after running
the update-linux-headers.sh script.

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
Based-on: <20210218151633.215374-1-ckuehl@redhat.com>
---
 target/i386/sev.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/target/i386/sev.c b/target/i386/sev.c
index 37690ae809c..92c69a23769 100644
--- a/target/i386/sev.c
+++ b/target/i386/sev.c
@@ -87,7 +87,7 @@ typedef struct __attribute__((__packed__)) SevInfoBlock {
 static SevGuestState *sev_guest;
 static Error *sev_mig_blocker;
 
-static const char *const sev_fw_errlist[] = {
+static const char *const sev_fw_errlist[SEV_RET_MAX] = {
     [SEV_RET_SUCCESS]                = "",
     [SEV_RET_INVALID_PLATFORM_STATE] = "Platform state is invalid",
     [SEV_RET_INVALID_GUEST_STATE]    = "Guest state is invalid",
@@ -114,6 +114,8 @@ static const char *const sev_fw_errlist[] = {
     [SEV_RET_RESOURCE_LIMIT]         = "Required firmware resource depleted",
     [SEV_RET_SECURE_DATA_INVALID]    = "Part-specific integrity check failure",
 };
+/* Ensure sev_fw_errlist[] is updated after running update-linux-headers.sh */
+QEMU_BUILD_BUG_ON(SEV_RET_SECURE_DATA_INVALID + 1 != SEV_RET_MAX);
 
 #define SEV_FW_MAX_ERROR      ARRAY_SIZE(sev_fw_errlist)
 
@@ -160,6 +162,7 @@ fw_error_to_str(int code)
     if (code < 0 || code >= SEV_FW_MAX_ERROR) {
         return "unknown error";
     }
+    assert(sev_fw_errlist[code]);
 
     return sev_fw_errlist[code];
 }
-- 
2.26.2



             reply	other threads:[~2021-02-19 18:03 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-19 18:01 Philippe Mathieu-Daudé [this message]
2021-02-19 20:21 ` [PATCH] target/i386/sev: Ensure sev_fw_errlist is sync with update-linux-headers Connor Kuehl
2021-03-08 10:21 ` Philippe Mathieu-Daudé
2021-03-18 15:38   ` Philippe Mathieu-Daudé
2021-03-18 15:44     ` Brijesh Singh
2021-06-02 10:48 ` Philippe Mathieu-Daudé
2021-06-02 14:22   ` Eduardo Habkost
2021-06-03  7:30     ` Philippe Mathieu-Daudé

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=20210219180131.2061072-1-philmd@redhat.com \
    --to=philmd@redhat.com \
    --cc=brijesh.singh@amd.com \
    --cc=ckuehl@redhat.com \
    --cc=ehabkost@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=richard.henderson@linaro.org \
    --cc=thomas.lendacky@amd.com \
    /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.