[RFC v2 04/13] x86/mm: Add helper functions for MKTME memory encryption keys
Peter Zijlstra
peterz at infradead.org
Tue Dec 4 09:14:34 UTC 2018
On Mon, Dec 03, 2018 at 11:39:51PM -0800, Alison Schofield wrote:
> +int mktme_map_keyid_from_key(void *key)
> +{
> + int i;
> +
> + for (i = 1; i <= mktme_nr_keyids; i++)
> + if (mktme_map->key[i] == key)
> + return i;
CodingStyle
> + return 0;
> +}
> +int mktme_map_get_free_keyid(void)
> +{
> + int i;
> +
> + if (mktme_map->mapped_keyids < mktme_nr_keyids) {
> + for (i = 1; i <= mktme_nr_keyids; i++)
> + if (mktme_map->key[i] == 0)
> + return i;
CodingStyle
> + }
> + return 0;
> +}
More information about the Linux-security-module-archive
mailing list