Commit ca2b746d authored by Minjie Du's avatar Minjie Du Committed by Michael Ellerman

powerpc/pseries: use kfree_sensitive() in plpks_gen_password()

password might contain private information, so better use
kfree_sensitive to free it.
In plpks_gen_password() use kfree_sensitive().
Signed-off-by: default avatarMinjie Du <duminjie@vivo.com>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
Link: https://msgid.link/20230717092648.9752-1-duminjie@vivo.com
parent 74726fda
...@@ -150,7 +150,7 @@ static int plpks_gen_password(void) ...@@ -150,7 +150,7 @@ static int plpks_gen_password(void)
ospasswordlength = maxpwsize; ospasswordlength = maxpwsize;
ospassword = kzalloc(maxpwsize, GFP_KERNEL); ospassword = kzalloc(maxpwsize, GFP_KERNEL);
if (!ospassword) { if (!ospassword) {
kfree(password); kfree_sensitive(password);
return -ENOMEM; return -ENOMEM;
} }
memcpy(ospassword, password, ospasswordlength); memcpy(ospassword, password, ospasswordlength);
...@@ -163,7 +163,7 @@ static int plpks_gen_password(void) ...@@ -163,7 +163,7 @@ static int plpks_gen_password(void)
} }
} }
out: out:
kfree(password); kfree_sensitive(password);
return pseries_status_to_err(rc); return pseries_status_to_err(rc);
} }
......
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