]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
crypto: asymmetric_keys - fix uninitialized pointers with free attribute
authorAlly Heev <allyheev@gmail.com>
Tue, 11 Nov 2025 13:36:29 +0000 (19:06 +0530)
committerHerbert Xu <herbert@gondor.apana.org.au>
Sat, 22 Nov 2025 02:04:50 +0000 (10:04 +0800)
commit79492d5adf456051908878816f1682144962be75
tree338c3e00315177ad4471ed59e125ad44a84ead07
parenta26c23e0d679cbb0de91e96e6384daef2dcfd6c8
crypto: asymmetric_keys - fix uninitialized pointers with free attribute

Uninitialized pointers with `__free` attribute can cause undefined
behavior as the memory assigned randomly to the pointer is freed
automatically when the pointer goes out of scope.

crypto/asymmetric_keys doesn't have any bugs related to this as of now,
but, it is better to initialize and assign pointers with `__free`
attribute in one statement to ensure proper scope-based cleanup

Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
Closes: https://lore.kernel.org/all/aPiG_F5EBQUjZqsl@stanley.mountain/
Signed-off-by: Ally Heev <allyheev@gmail.com>
Reviewed-by: Ignat Korchagin <ignat@cloudflare.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
crypto/asymmetric_keys/x509_cert_parser.c
crypto/asymmetric_keys/x509_public_key.c