[prev in list] [next in list] [prev in thread] [next in thread] 

List:       linux-keyrings
Subject:    Re: [PATCH v10 05/12] nfit/libnvdimm: add unlock of nvdimm support for Intel DIMMs
From:       David Howells <dhowells () redhat ! com>
Date:       2018-09-28 8:24:28
Message-ID: 24969.1538123068 () warthog ! procyon ! org ! uk
[Download RAW message or body]

Dave Jiang <dave.jiang@intel.com> wrote:

> +/*
> + * Find key in kernel keyring
> + */
> +static struct key *nvdimm_get_key(struct device *dev)

Note that the comment is no longer correct.

> +static struct key *nvdimm_request_key(struct device *dev)
> +{
> +	struct nvdimm *nvdimm = to_nvdimm(dev);
> +	struct key *key = NULL;
> +	char desc[NVDIMM_KEY_DESC_LEN + sizeof(NVDIMM_PREFIX)];
> +
> +	sprintf(desc, "%s%s", NVDIMM_PREFIX, nvdimm->dimm_id);
> +	key = request_key(&key_type_logon, desc, desc);

I would suggest passing "" as the callout_info rather than duplicating the
description.  The description is available to the upcall program anyway.

> +			key_link(nvdimm_keyring, key);
> +			nvdimm->key = key;

Since you're attaching the key to the nvdimm struct, do you actually need a
kernel keyring also?  You only ever link things into it and unlink things from
it; you never actually search it that I can see.  I would suggest, therefore,
just getting rid of the nvdimm_keyring entirely.  The keys are retained by the
nvdimm struct, so that shouldn't be a problem.

David
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic