lkml.org 
[lkml]   [2017]   [Sep]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [RFC Part2 PATCH v3 13/26] KVM: SVM: Add KVM_SEV_INIT command
From
Date
Hi Boris,

thanks for the detail review.

On 09/13/2017 10:06 AM, Borislav Petkov wrote:
...

>> +static int sev_platform_get_state(int *state, int *error)
>> +{
>> + int ret;
>> + struct sev_data_status *data;
>> +
>> + data = kzalloc(sizeof(*data), GFP_KERNEL);
>
> It's a bit silly to do the allocation only for the duration of
> sev_platform_status() - just allocate "data" on the stack.
>

I am okay with moving it on the stack but just to give context why
I went in this way. The physical address of data is given to the
device (in this case SEV FW). I was not sure if its okay to pass the
stack address to the device. Additionally, the FW spec requires us to
zero all the fields -- so we need to memset if we allocate it on the
stack.

\
 
 \ /
  Last update: 2017-09-13 18:23    [W:0.160 / U:4.740 seconds]
©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site