@@ -1189,8 +1189,8 @@ static __init int svm_hardware_setup(void)
static int sev_platform_get_state(int *state, int *error)
{
- int ret;
struct sev_data_status *data;
+ int ret;
data = kzalloc(sizeof(*data), GFP_KERNEL);
if (!data)
@@ -1201,7 +1201,7 @@ static int sev_platform_get_state(int *state, int *error)
*state = data->state;
pr_info_once("SEV firmware major %d minor %d build %d\n",
- data->api_major, data->api_minor, data->build);
+ data->api_major, data->api_minor, data->build);
kfree(data);
return ret;
@@ -5577,6 +5577,7 @@ static int sev_guest_init(struct kvm *kvm, struct kvm_sev_cmd *argp)
sev->active = true;
sev->asid = asid;
+
return 0;
e_shutdown:
@@ -5598,17 +5599,19 @@ static int svm_mem_enc_op(struct kvm *kvm, void __user *argp)
mutex_lock(&kvm->lock);
switch (sev_cmd.id) {
- case KVM_SEV_INIT: {
+ case KVM_SEV_INIT:
r = sev_guest_init(kvm, &sev_cmd);
break;
- }
+
default:
break;
}
mutex_unlock(&kvm->lock);
+
if (copy_to_user(argp, &sev_cmd, sizeof(struct kvm_sev_cmd)))
r = -EFAULT;
+
return r;
}