qemu-ppc
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-ppc] [Qemu-devel] [PATCH 09/17] pseries: rework PAPR virtual S


From: Paolo Bonzini
Subject: Re: [Qemu-ppc] [Qemu-devel] [PATCH 09/17] pseries: rework PAPR virtual SCSI
Date: Mon, 15 Jul 2013 15:11:48 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130514 Thunderbird/17.0.6

Il 08/07/2013 20:42, Anthony Liguori ha scritto:
>> > +static int vscsi_fetch_desc(VSCSIState *s, struct vscsi_req *req,
>> > +                            unsigned n, unsigned buf_offset,
>> > +                            struct srp_direct_buf *ret)
>> > +{
>> > +    struct srp_cmd *cmd = &req->iu.srp.cmd;
>> > +
>> > +    switch (req->dma_fmt) {
>> > +    case SRP_NO_DATA_DESC: {
>> > +        dprintf("VSCSI: no data descriptor\n");
>> > +        return 0;
>> > +    }
>> > +    case SRP_DATA_DESC_DIRECT: {
>> > +        *ret = *(struct srp_direct_buf *)(cmd->add_data +
>> > req->cdb_offset);
> If you're reworking this code, you should remove these casts.  It's not
> safe to assume that cdb_offset is aligned properly.  memcpy()'ing would
> be much safer.

Or simply declare struct srp_direct_buf as packed (even better, use a
typedef as in the coding conventions).

Paolo



reply via email to

[Prev in Thread] Current Thread [Next in Thread]