[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v1 3/8] s390/sclp: rework sclp boundary and length checks
From: |
Collin Walling |
Subject: |
Re: [PATCH v1 3/8] s390/sclp: rework sclp boundary and length checks |
Date: |
Thu, 14 May 2020 13:23:15 -0400 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.5.0 |
On 5/13/20 3:00 AM, Cornelia Huck wrote:
> On Tue, 12 May 2020 10:55:56 -0400
> Collin Walling <address@hidden> wrote:
>
>> On 5/12/20 3:21 AM, David Hildenbrand wrote:
>>> On 09.05.20 01:08, Collin Walling wrote:
>
>>>> +static bool check_sufficient_sccb_len(SCCB *sccb, int size)
>>>
>>> "has_sufficient_sccb_len" ?
>>>
>>>> +{
>>>> + MachineState *ms = MACHINE(qdev_get_machine());
>>>> + int required_len = size + ms->possible_cpus->len * sizeof(CPUEntry);
>>>
>>> Rather pass in the number of cpus instead. Looking up the machine again
>>> in here is ugly.
>>
>> prepare_cpu_entries also looks up the machine again. Should I squeeze
>> in a cleanup where we pass the machine to that function too (perhaps
>> in the "remove SCLPDevice" patch)?
>
> sclp_read_cpu_info() does not have the machine handy, so you'd need to
> move machine lookup there; but I think it's worth getting rid of
> duplicate lookups.
>
Sounds good, then. I'll propose a change to patch 1 that removes the
unused SCLPDevice param and accepts a MachineState instead. Should make
things a bit cleaner :)
>>
>>>
>>>> +
>>>> + if (be16_to_cpu(sccb->h.length) < required_len) {
>>>> + sccb->h.response_code =
>>>> cpu_to_be16(SCLP_RC_INSUFFICIENT_SCCB_LENGTH);
>>>> + return false;
>>>> + }
>>>> + return true;
>>>> +}
>>>> +
>
>
--
--
Regards,
Collin
Stay safe and stay healthy
[PATCH v1 7/8] s390/kvm: header sync for diag318, Collin Walling, 2020/05/08
[PATCH v1 2/8] s390/sclp: check sccb len before filling in data, Collin Walling, 2020/05/08
- Re: [PATCH v1 2/8] s390/sclp: check sccb len before filling in data, Janosch Frank, 2020/05/11
- Re: [PATCH v1 2/8] s390/sclp: check sccb len before filling in data, David Hildenbrand, 2020/05/11
- Re: [PATCH v1 2/8] s390/sclp: check sccb len before filling in data, Collin Walling, 2020/05/11
- Re: [PATCH v1 2/8] s390/sclp: check sccb len before filling in data, Janosch Frank, 2020/05/11
- Re: [PATCH v1 2/8] s390/sclp: check sccb len before filling in data, David Hildenbrand, 2020/05/11
- Re: [PATCH v1 2/8] s390/sclp: check sccb len before filling in data, Cornelia Huck, 2020/05/12