diff options
| author | Thorsten Blum <thorsten.blum@linux.dev> | 2025-04-07 10:22:47 +0200 |
|---|---|---|
| committer | Herbert Xu <herbert@gondor.apana.org.au> | 2025-04-16 15:16:20 +0800 |
| commit | b93336cd767fc266dcccfa034a1fb32ae1a23564 (patch) | |
| tree | e09ffcc23c0e1f0bfd131654c3ec2dc5c1ae269b /crypto/asymmetric_keys | |
| parent | crypto: ahash - Remove request chaining (diff) | |
| download | linux-b93336cd767fc266dcccfa034a1fb32ae1a23564.tar.gz linux-b93336cd767fc266dcccfa034a1fb32ae1a23564.zip | |
crypto: x509 - Replace kmalloc() + NUL-termination with kzalloc()
Use kzalloc() to zero out the one-element array instead of using
kmalloc() followed by a manual NUL-termination.
No functional changes intended.
Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
Reviewed-by: Lukas Wunner <lukas@wunner.de>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'crypto/asymmetric_keys')
| -rw-r--r-- | crypto/asymmetric_keys/x509_cert_parser.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/crypto/asymmetric_keys/x509_cert_parser.c b/crypto/asymmetric_keys/x509_cert_parser.c index ee2fdab42334..2ffe4ae90bea 100644 --- a/crypto/asymmetric_keys/x509_cert_parser.c +++ b/crypto/asymmetric_keys/x509_cert_parser.c @@ -372,10 +372,9 @@ static int x509_fabricate_name(struct x509_parse_context *ctx, size_t hdrlen, /* Empty name string if no material */ if (!ctx->cn_size && !ctx->o_size && !ctx->email_size) { - buffer = kmalloc(1, GFP_KERNEL); + buffer = kzalloc(1, GFP_KERNEL); if (!buffer) return -ENOMEM; - buffer[0] = 0; goto done; } |
