[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-ppc] [PATCH] spapr-vscsi: Adding VSCSI capabilities
From: |
Nikunj A Dadhania |
Subject: |
Re: [Qemu-ppc] [PATCH] spapr-vscsi: Adding VSCSI capabilities |
Date: |
Mon, 26 Aug 2013 14:36:17 +0530 |
User-agent: |
Notmuch/0.14+104~g0a21fb9 (http://notmuchmail.org) Emacs/24.3.50.1 (x86_64-unknown-linux-gnu) |
Benjamin Herrenschmidt <address@hidden> writes:
> On Mon, 2013-08-26 at 10:02 +0530, Nikunj A Dadhania wrote:
>
>>
>> From: Nikunj A Dadhania <address@hidden>
>>
>> This implements capabilities exchange between host and client.
>> As at the moment no capability is supported, put zero flags everywhere
>> and return.
>>
>> Signed-off-by: Nikunj A Dadhania <address@hidden>
>> ---
>> hw/scsi/spapr_vscsi.c | 37 +++++++++++++++++++++++++++++++++++++
>> 1 file changed, 37 insertions(+)
>>
>> diff --git a/hw/scsi/spapr_vscsi.c b/hw/scsi/spapr_vscsi.c
>> index e9090e5..fae3644 100644
>> --- a/hw/scsi/spapr_vscsi.c
>> +++ b/hw/scsi/spapr_vscsi.c
>> @@ -858,6 +858,40 @@ static int vscsi_send_adapter_info(VSCSIState *s,
>> vscsi_req *req)
>> return vscsi_send_iu(s, req, sizeof(*sinfo), VIOSRP_MAD_FORMAT);
>> }
>>
>> +static int vscsi_send_capabilities(VSCSIState *s, vscsi_req *req)
>> +{
>> + struct viosrp_capabilities *vcap;
>> + struct capabilities cap;
>> + uint16_t len = 0;
>
> The above initialization isn't useful
>
>> + int rc = true;
>> +
>> + vcap = &req->iu.mad.capabilities;
>> + len = be16_to_cpu(vcap->common.length);
>> + if (len > sizeof(&cap)) {
> ^ Ugh ? Why the & here ?
Oops, got that wrong.
>
>> + fprintf(stderr, "vscsi_send_capabilities: size out of bound !\n");
>> + goto error_out;
>> + }
>
> I am not 100% familiar with the protocol, could it be that we should
> just read sizeof(cap) instead of erroring out or is there no way it
> can be correct and have a len too long ?
If the length is incorrect, can we trust whether cap is correct or is of
the type we are expecting?
- Re: [Qemu-ppc] [PATCH] spapr-vscsi: Adding VSCSI capabilities, (continued)
- Re: [Qemu-ppc] [PATCH] spapr-vscsi: Adding VSCSI capabilities, Nikunj A Dadhania, 2013/08/26
- Re: [Qemu-ppc] [PATCH] spapr-vscsi: Adding VSCSI capabilities, Alexander Graf, 2013/08/26
- Re: [Qemu-ppc] [PATCH] spapr-vscsi: Adding VSCSI capabilities, Benjamin Herrenschmidt, 2013/08/26
- Re: [Qemu-ppc] [PATCH] spapr-vscsi: Adding VSCSI capabilities, Nikunj A Dadhania, 2013/08/26
- Re: [Qemu-ppc] [PATCH] spapr-vscsi: Adding VSCSI capabilities, Nikunj A Dadhania, 2013/08/26
- Re: [Qemu-ppc] [PATCH] spapr-vscsi: Adding VSCSI capabilities, Alexander Graf, 2013/08/26
- Re: [Qemu-ppc] [PATCH] spapr-vscsi: Adding VSCSI capabilities, Nikunj A Dadhania, 2013/08/26
- Re: [Qemu-ppc] [PATCH] spapr-vscsi: Adding VSCSI capabilities, Alexander Graf, 2013/08/26
- Re: [Qemu-ppc] [PATCH] spapr-vscsi: Adding VSCSI capabilities, Nikunj A Dadhania, 2013/08/27
- Re: [Qemu-ppc] [PATCH] spapr-vscsi: Adding VSCSI capabilities, Benjamin Herrenschmidt, 2013/08/26
- Re: [Qemu-ppc] [PATCH] spapr-vscsi: Adding VSCSI capabilities,
Nikunj A Dadhania <=
- Re: [Qemu-ppc] [PATCH] spapr-vscsi: Adding VSCSI capabilities, Paolo Bonzini, 2013/08/26
- Re: [Qemu-ppc] [PATCH] spapr-vscsi: Adding VSCSI capabilities, Nikunj A Dadhania, 2013/08/27