summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--drivers/platform/x86/hp/hp-bioscfg/spmobj-attributes.c11
1 files changed, 3 insertions, 8 deletions
diff --git a/drivers/platform/x86/hp/hp-bioscfg/spmobj-attributes.c b/drivers/platform/x86/hp/hp-bioscfg/spmobj-attributes.c
index 02291e32684f..86f90238750c 100644
--- a/drivers/platform/x86/hp/hp-bioscfg/spmobj-attributes.c
+++ b/drivers/platform/x86/hp/hp-bioscfg/spmobj-attributes.c
@@ -230,12 +230,10 @@ static ssize_t sk_store(struct kobject *kobj,
length--;
/* allocate space and copy current signing key */
- bioscfg_drv.spm_data.signing_key = kmalloc(length, GFP_KERNEL);
+ bioscfg_drv.spm_data.signing_key = kmemdup(buf, length, GFP_KERNEL);
if (!bioscfg_drv.spm_data.signing_key)
return -ENOMEM;
- memcpy(bioscfg_drv.spm_data.signing_key, buf, length);
-
/* submit signing key payload */
ret = hp_wmi_perform_query(HPWMI_SECUREPLATFORM_SET_SK,
HPWMI_SECUREPLATFORM,
@@ -267,14 +265,12 @@ static ssize_t kek_store(struct kobject *kobj,
length--;
/* allocate space and copy current signing key */
- bioscfg_drv.spm_data.endorsement_key = kmalloc(length, GFP_KERNEL);
+ bioscfg_drv.spm_data.endorsement_key = kmemdup(buf, length, GFP_KERNEL);
if (!bioscfg_drv.spm_data.endorsement_key) {
ret = -ENOMEM;
goto exit_kek;
}
- memcpy(bioscfg_drv.spm_data.endorsement_key, buf, length);
-
ret = hp_wmi_perform_query(HPWMI_SECUREPLATFORM_SET_KEK,
HPWMI_SECUREPLATFORM,
(void *)bioscfg_drv.spm_data.endorsement_key,
@@ -314,13 +310,12 @@ static ssize_t auth_token_store(struct kobject *kobj,
length--;
/* allocate space and copy current auth token */
- bioscfg_drv.spm_data.auth_token = kmalloc(length, GFP_KERNEL);
+ bioscfg_drv.spm_data.auth_token = kmemdup(buf, length, GFP_KERNEL);
if (!bioscfg_drv.spm_data.auth_token) {
ret = -ENOMEM;
goto exit_token;
}
- memcpy(bioscfg_drv.spm_data.auth_token, buf, length);
return count;
exit_token: