[RFC PATCH 5/6] KEYS: Replace assoc_array with struct keyring_index

Jarkko Sakkinen jarkko at kernel.org
Thu Oct 22 15:56:02 UTC 2026


On Mon, Oct 19, 2026 at 04:02:48PM +0100, David Howells wrote:
> Please don't put this in keyring_link.  It's only needed by __key_link() and
> friends and could be passed around in a context struct as the edit script is
> done now:
> 
> 	struct keyring_link_context {
> 		struct keyring_link *spare;	/* Spare link block */
> 		struct keyring_link *replace;	/* Link being replaced */
> 	};
> 
> then:
> 
> 	 int __key_link_begin(struct key *keyring,
> 			     const struct keyring_index_key *index_key,
> 	-		     struct assoc_array_edit **_edit)
> 	+		     struct keyring_link_context **_edit)

Hmm... I think it would be more transparent to pass two element array
than declare a struct here. It does not do a lot and makes the code
just require more cross-referencing.

I'm not fighting over this detail but even when I look at the patch
the struct makes it more confusing to proof-read.

Br, Jarkko



More information about the Linux-security-module-archive mailing list