]> www.infradead.org Git - users/sagi/libnvme.git/commit
test: pass a large enough buffer to nvme_identify_ns_descs()
authorCaleb Sander <csander@purestorage.com>
Sat, 12 Aug 2023 19:55:12 +0000 (13:55 -0600)
committerDaniel Wagner <wagi@monom.org>
Thu, 17 Aug 2023 12:56:12 +0000 (14:56 +0200)
commitb21ad1f350db19982f1b53c0150fd70b31a208cd
treeeb624455877e4eaaf2a1b7da5b5ce2ae676c43f0
parentf07b63103878c8c973182bf63459e2e1556cc2db
test: pass a large enough buffer to nvme_identify_ns_descs()

nvme_identify_ns_descs() takes a struct nvme_ns_id_desc * parameter,
but passes it as the data to nvme_identify(), which sets data_len = 4K.
But struct nvme_ns_id_desc only represents the start of a single
Namespace Identification Descriptor, so it is less than 4 KB.
So it needs to be explicitly allocated with at least 4 KB.
Allocate a 4 KB buffer in test.c to avoid a stack buffer overflow.

Signed-off-by: Caleb Sander <csander@purestorage.com>
test/test.c