mirror of https://github.com/xemu-project/xemu.git
hw/nvme: verify uniqueness of reclaim unit handle identifiers
Verify that a reclaim unit handle identifier is only specified once in
fdp.ruhs.
Fixes: 73064edfb8
("hw/nvme: flexible data placement emulation")
Reviewed-by: Jesper Wendel Devantier <j.devantier@samsung.com>
Signed-off-by: Klaus Jensen <k.jensen@samsung.com>
This commit is contained in:
parent
3ae8a54a08
commit
94fa8ca7ee
11
hw/nvme/ns.c
11
hw/nvme/ns.c
|
@ -453,6 +453,17 @@ static bool nvme_ns_init_fdp(NvmeNamespace *ns, Error **errp)
|
|||
|
||||
free(r);
|
||||
|
||||
/* verify that the ruhids are unique */
|
||||
for (unsigned int i = 0; i < ns->fdp.nphs; i++) {
|
||||
for (unsigned int j = i + 1; j < ns->fdp.nphs; j++) {
|
||||
if (ruhids[i] == ruhids[j]) {
|
||||
error_setg(errp, "duplicate reclaim unit handle identifier: %u",
|
||||
ruhids[i]);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ph = ns->fdp.phs = g_new(uint16_t, ns->fdp.nphs);
|
||||
|
||||
ruhid = ruhids;
|
||||
|
|
Loading…
Reference in New Issue