All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Daniel P. Berrangé" <berrange@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Pierrick Bouvier" <pierrick.bouvier@linaro.org>,
	"Philippe Mathieu-Daudé" <philmd@linaro.org>,
	"Keith Busch" <kbusch@kernel.org>,
	"Kevin Wolf" <kwolf@redhat.com>,
	"Stefan Hajnoczi" <stefanha@redhat.com>,
	"Avi Kivity" <avi@scylladb.com>, "Fam Zheng" <fam@euphon.net>,
	"Hanna Reitz" <hreitz@redhat.com>,
	"Jesper Devantier" <foss@defmacro.it>,
	qemu-block@nongnu.org, "Klaus Jensen" <its@irrelevant.dk>,
	"Daniel P. Berrangé" <berrange@redhat.com>
Subject: [PATCH 1/4] include/block: define constants for NVME string fields
Date: Fri,  6 Mar 2026 16:57:14 +0000	[thread overview]
Message-ID: <20260306165717.3360110-2-berrange@redhat.com> (raw)
In-Reply-To: <20260306165717.3360110-1-berrange@redhat.com>

The version, model and serial fields accept fixed length strings.
Add constants to enable user supplied strings to be validated.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
---
 include/block/nvme.h | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/include/block/nvme.h b/include/block/nvme.h
index 9d7159ed7a..e4e7be5120 100644
--- a/include/block/nvme.h
+++ b/include/block/nvme.h
@@ -1134,12 +1134,16 @@ enum NvmeIdCns {
     NVME_ID_CNS_CS_IND_NS_ALLOCATED   = 0x1f,
 };
 
+#define NVME_ID_CTRL_SN_MAX_LEN 20
+#define NVME_ID_CTRL_MN_MAX_LEN 40
+#define NVME_ID_CTRL_FR_MAX_LEN 8
+
 typedef struct QEMU_PACKED NvmeIdCtrl {
     uint16_t    vid;
     uint16_t    ssvid;
-    uint8_t     sn[20];
-    uint8_t     mn[40];
-    uint8_t     fr[8];
+    uint8_t     sn[NVME_ID_CTRL_SN_MAX_LEN];
+    uint8_t     mn[NVME_ID_CTRL_MN_MAX_LEN];
+    uint8_t     fr[NVME_ID_CTRL_FR_MAX_LEN];
     uint8_t     rab;
     uint8_t     ieee[3];
     uint8_t     cmic;
-- 
2.53.0



  reply	other threads:[~2026-03-06 16:58 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-06 16:57 [PATCH 0/4] hw/nvme: make model & firmware version cnofigurable Daniel P. Berrangé
2026-03-06 16:57 ` Daniel P. Berrangé [this message]
2026-03-06 16:57 ` [PATCH 2/4] hw/nvme: report error for oversized 'serial' parameter Daniel P. Berrangé
2026-03-06 16:57 ` [PATCH 3/4] hw/nvme: add user controlled 'model' property Daniel P. Berrangé
2026-03-06 16:57 ` [PATCH 4/4] hw/nvme: add user controlled 'firmware-version' property Daniel P. Berrangé
2026-03-06 17:05 ` [PATCH 0/4] hw/nvme: make model & firmware version cnofigurable Keith Busch
2026-03-10  9:29   ` Daniel P. Berrangé
2026-03-19 15:55 ` Avi Kivity
2026-04-13 17:34 ` Klaus Jensen
2026-05-18 11:44   ` Avi Kivity
2026-05-21  8:17     ` Avi Kivity

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=20260306165717.3360110-2-berrange@redhat.com \
    --to=berrange@redhat.com \
    --cc=avi@scylladb.com \
    --cc=fam@euphon.net \
    --cc=foss@defmacro.it \
    --cc=hreitz@redhat.com \
    --cc=its@irrelevant.dk \
    --cc=kbusch@kernel.org \
    --cc=kwolf@redhat.com \
    --cc=philmd@linaro.org \
    --cc=pierrick.bouvier@linaro.org \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.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.