Commit 212dd5cf authored by Nayna Jain's avatar Nayna Jain Committed by Michael Ellerman

powerpc/pseries: replace kmalloc with kzalloc in PLPKS driver

Replace kmalloc with kzalloc in construct_auth() function to default
initialize structure with zeroes.
Signed-off-by: default avatarNayna Jain <nayna@linux.ibm.com>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20221106205839.600442-6-nayna@linux.ibm.com
parent 8888ea77
...@@ -162,19 +162,15 @@ static struct plpks_auth *construct_auth(u8 consumer) ...@@ -162,19 +162,15 @@ static struct plpks_auth *construct_auth(u8 consumer)
if (consumer > PKS_OS_OWNER) if (consumer > PKS_OS_OWNER)
return ERR_PTR(-EINVAL); return ERR_PTR(-EINVAL);
auth = kmalloc(struct_size(auth, password, maxpwsize), GFP_KERNEL); auth = kzalloc(struct_size(auth, password, maxpwsize), GFP_KERNEL);
if (!auth) if (!auth)
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
auth->version = 1; auth->version = 1;
auth->consumer = consumer; auth->consumer = consumer;
auth->rsvd0 = 0;
auth->rsvd1 = 0;
if (consumer == PKS_FW_OWNER || consumer == PKS_BOOTLOADER_OWNER) { if (consumer == PKS_FW_OWNER || consumer == PKS_BOOTLOADER_OWNER)
auth->passwordlength = 0;
return auth; return auth;
}
memcpy(auth->password, ospassword, ospasswordlength); memcpy(auth->password, ospassword, ospasswordlength);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment