numam-spdk/examples
Niklas Cassel 7ce5dd62f7 nvme/identify: use calloc to allocate zone report buffer
When support for printing the zone report was added,
the zone report buffer was allocated using calloc().

This was intentionally changed to a malloc in commit
5ef79a17ec ("examples/nvme/identify: add an option to dump
the full zns zone report").

While we shouldn't need to zero the buffer, since the drive
should write  the "Number of Zones" field in zone report header,
and we should never read zone descriptors beyond this value,
the ZNS spec also states that reading beyond the last zone
descriptor has undefined results.

Considering that "Number of Zones" field in the zone report
header will only represent the number of zone descriptors
in the buffer when the partial bit was set to true,
always use calloc(), to avoid the chance that someone might
copy this code and call spdk_nvme_zns_report_zones() with the
partial bit set to false.

Signed-off-by: Niklas Cassel <niklas.cassel@wdc.com>
Change-Id: Ia39c5235aa5c62a4ec42285f53f4bc80f7ec370f
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7004
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2021-03-29 10:17:45 +00:00
..
accel lib/accel: Add the real chained crc32 support with the example. 2021-02-25 10:25:49 +00:00
bdev bdev/hello_world: for zoned bdevs, reset the zone before write 2021-03-29 10:17:45 +00:00
blob build: use DEPDIRS variables to build SPDK_LIB_LIST 2020-12-18 09:40:01 +00:00
interrupt_tgt examples/interrupt_tgt: Fix app compiling error without vhost. 2021-01-26 08:33:44 +00:00
ioat build: use DEPDIRS variables to build SPDK_LIB_LIST 2020-12-18 09:40:01 +00:00
nvme nvme/identify: use calloc to allocate zone report buffer 2021-03-29 10:17:45 +00:00
nvmf event: Add return code to spdk_rpc_initialize 2021-03-12 08:38:10 +00:00
sock build: use DEPDIRS variables to build SPDK_LIB_LIST 2020-12-18 09:40:01 +00:00
vmd lib/vmd: detach devices during shutdown 2020-02-04 16:50:25 +00:00
Makefile examples/interrupt_tgt: Fix app compiling error without vhost. 2021-01-26 08:33:44 +00:00