Skip to content

Commit c6fcccd

Browse files
committed
dm-crypt: Adjust crypt_alloc_tfms_aead() allocation type
In preparation for making the kmalloc family of allocators type aware, we need to make sure that the returned type from the allocation matches the type of the variable being assigned. (Before, the allocator would always return "void *", which can be implicitly cast to any pointer type.) The assigned type is "struct crypto_skcipher **" but the returned type will be "struct crypto_aead **". These are the same allocation size (pointer size), but the types don't match. Adjust the allocation type to match the assignment. Link: https://patch.msgid.link/20250426061629.work.266-kees@kernel.org Signed-off-by: Kees Cook <kees@kernel.org>
1 parent 2b7a25d commit c6fcccd

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

drivers/md/dm-crypt.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2364,7 +2364,7 @@ static int crypt_alloc_tfms_aead(struct crypt_config *cc, char *ciphermode)
23642364
{
23652365
int err;
23662366

2367-
cc->cipher_tfm.tfms = kmalloc(sizeof(struct crypto_aead *), GFP_KERNEL);
2367+
cc->cipher_tfm.tfms = kmalloc(sizeof(struct crypto_skcipher *), GFP_KERNEL);
23682368
if (!cc->cipher_tfm.tfms)
23692369
return -ENOMEM;
23702370

0 commit comments

Comments
 (0)