hw/nvme: Fix bootindex suffix use-after-free
The bootindex suffix can be used as long as the property is alive. Signed-off-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Message-ID: <20260125-nvme-v1-5-0658c31fade9@rsg.ci.i.u-tokyo.ac.jp> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> (cherry picked from commit eda9baa17a2854494709a8094419ba6a6901721d) Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
This commit is contained in:
parent
a2fbfefbb7
commit
89f7d4fb13
2 changed files with 4 additions and 4 deletions
|
|
@ -944,12 +944,11 @@ static void nvme_ns_class_init(ObjectClass *oc, const void *data)
|
|||
static void nvme_ns_instance_init(Object *obj)
|
||||
{
|
||||
NvmeNamespace *ns = NVME_NS(obj);
|
||||
char *bootindex = g_strdup_printf("/namespace@%d,0", ns->params.nsid);
|
||||
|
||||
sprintf(ns->bootindex_suffix, "/namespace@%" PRIu32 ",0", ns->params.nsid);
|
||||
|
||||
device_add_bootindex_property(obj, &ns->bootindex, "bootindex",
|
||||
bootindex, DEVICE(obj));
|
||||
|
||||
g_free(bootindex);
|
||||
ns->bootindex_suffix, DEVICE(obj));
|
||||
}
|
||||
|
||||
static const TypeInfo nvme_ns_info = {
|
||||
|
|
|
|||
|
|
@ -239,6 +239,7 @@ typedef struct NvmeNamespace {
|
|||
DeviceState parent_obj;
|
||||
BlockConf blkconf;
|
||||
int32_t bootindex;
|
||||
char bootindex_suffix[24];
|
||||
int64_t size;
|
||||
int64_t moff;
|
||||
NvmeIdNs id_ns;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue