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>pull/1250/head
parent
5bb61dc76d
commit
b93336cd76
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue