[PATCH 5/9] nvme-keyring: add nvme_tls_psk_refresh()

Eric Biggers ebiggers at kernel.org
Mon Jul 22 18:54:25 PDT 2024


On Mon, Jul 22, 2024 at 04:21:18PM +0200, Hannes Reinecke wrote:
> +struct key *nvme_tls_psk_refresh(struct key *keyring, char *hostnqn, char *subnqn,
> +		u8 hmac_id, bool generated, u8 *data, size_t data_len, char *digest)

For inputs use pointer to const, e.g. 'const char *hostnqn'.
This applies to the whole patchset.

> +	identity = kzalloc(identity_len, GFP_KERNEL);
> +	if (!identity)
> +		return ERR_PTR(-ENOMEM);
> +
> +	snprintf(identity, identity_len, "NVMe1%c%02d %s %s %s",
> +		 generated ? 'G' : 'R', hmac_id, hostnqn, subnqn, digest);

This is reinventing kasprintf().

- Eric



More information about the Linux-nvme mailing list