Commit a9a13c73 authored by Thorsten Blum's avatar Thorsten Blum Committed by Jakub Kicinski
Browse files

keys, dns: Use kmalloc_flex to improve dns_resolver_preparse



Use kmalloc_flex() when allocating a new 'struct user_key_payload' in
dns_resolver_preparse() to replace the open-coded size arithmetic.

Signed-off-by: default avatarThorsten Blum <thorsten.blum@linux.dev>
Link: https://patch.msgid.link/20260226214930.785423-3-thorsten.blum@linux.dev


Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 58e443b7
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -215,7 +215,7 @@ dns_resolver_preparse(struct key_preparsed_payload *prep)
	kdebug("store result");
	prep->quotalen = result_len;

	upayload = kmalloc(sizeof(*upayload) + result_len + 1, GFP_KERNEL);
	upayload = kmalloc_flex(*upayload, data, result_len + 1);
	if (!upayload) {
		kleave(" = -ENOMEM");
		return -ENOMEM;