[PATCH v3 1/3] nvme-auth: alloc nvme_dhchap_key as single buffer

Christoph Hellwig hch at lst.de
Mon Oct 16 23:09:08 PDT 2023


> +struct nvme_dhchap_key *nvme_auth_alloc_key(u32 len, u8 hash)
> +{
> +	struct nvme_dhchap_key *key = kzalloc(len + sizeof(*key), GFP_KERNEL);

This should use the struct_size() helper:

	key = kzalloc(struct_size(key, key, len), GFP_KERNEL);

Otherwise the change looks good.



More information about the Linux-nvme mailing list