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

From: Christoph Hellwig
Date: Tue Oct 17 2023 - 02:09:15 EST


> +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.