mirror of
https://github.com/torvalds/linux.git
synced 2026-07-27 09:36:22 +02:00
keys: use kmalloc_flex in user_preparse
Use kmalloc_flex() when allocating a new struct user_key_payload in user_preparse() to replace the open-coded size arithmetic and to keep the size type-safe. Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev> Link: https://lore.kernel.org/r/20260504093058.49720-3-thorsten.blum@linux.dev Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org> Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>
This commit is contained in:
parent
4d05e948ce
commit
8f2e22cfc4
|
|
@ -64,7 +64,7 @@ int user_preparse(struct key_preparsed_payload *prep)
|
|||
if (datalen == 0 || datalen > 32767 || !prep->data)
|
||||
return -EINVAL;
|
||||
|
||||
upayload = kmalloc(sizeof(*upayload) + datalen, GFP_KERNEL);
|
||||
upayload = kmalloc_flex(*upayload, data, datalen);
|
||||
if (!upayload)
|
||||
return -ENOMEM;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user