From: Stefan Priebe - Profihost AG <s.priebe@profihost.ag>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: Stefan Hajnoczi <stefanha@gmail.com>,
ceph-devel@vger.kernel.org, Stefan Weil <sw@weilnetz.de>,
qemu-devel <qemu-devel@nongnu.org>,
Josh Durgin <josh.durgin@inktank.com>
Subject: Re: [Qemu-devel] [PATCH] overflow of int ret: use ssize_t for ret
Date: Fri, 23 Nov 2012 15:38:17 +0100 [thread overview]
Message-ID: <50AF8A59.6060205@profihost.ag> (raw)
In-Reply-To: <CAFEAcA-JSXVHf2Ax=ren8emCMhf2=F0+V+7_crav1OiiZn2aOQ@mail.gmail.com>
Hi,
i'm not a ceph or inktank guy. I can't made any decision on what to
change. At least right now you'll see failing I/O's in your guest, when
you discard whole disks.
I could fix this for me with int64 and with ssize_t. So if i should
resend another patch i need a concrete advise how to patch.
Thanks!
Greets,
Stefan
Am 23.11.2012 15:15, schrieb Peter Maydell:
> On 23 November 2012 14:11, Stefan Hajnoczi <stefanha@gmail.com> wrote:
>> On Thu, Nov 22, 2012 at 10:07 AM, Stefan Priebe <s.priebe@profihost.ag> wrote:
>>> diff --git a/block/rbd.c b/block/rbd.c
>>> index 5a0f79f..0384c6c 100644
>>> --- a/block/rbd.c
>>> +++ b/block/rbd.c
>>> @@ -69,7 +69,7 @@ typedef enum {
>>> typedef struct RBDAIOCB {
>>> BlockDriverAIOCB common;
>>> QEMUBH *bh;
>>> - int ret;
>>> + ssize_t ret;
>>> QEMUIOVector *qiov;
>>> char *bounce;
>>> RBDAIOCmd cmd;
>>> @@ -86,7 +86,7 @@ typedef struct RADOSCB {
>>> int done;
>>> int64_t size;
>>> char *buf;
>>> - int ret;
>>> + ssize_t ret;
>>> } RADOSCB;
>>>
>>> #define RBD_FD_READ 0
>>
>> I preferred your previous patch:
>>
>> ssize_t on 32-bit hosts has sizeof(ssize_t) == 4. In
>> qemu_rbd_complete_aio() we may assign acb->ret = rcb->size. Here the
>> size field is int64_t, so ssize_t ret would truncate the value.
>
> The rcb size field should be a size_t: it is used for calling
> rbd_aio_write and rbd_aio_read so if we've overflowed 32 bits
> then we've already got a problem there.
>
> -- PMM
> --
> To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
next prev parent reply other threads:[~2012-11-23 14:38 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-11-22 9:07 [Qemu-devel] [PATCH] overflow of int ret: use ssize_t for ret Stefan Priebe
2012-11-22 16:40 ` Andreas Färber
2012-11-22 19:09 ` Stefan Priebe - Profihost AG
2012-11-22 19:37 ` Stefan Weil
2012-11-22 20:49 ` Stefan Priebe - Profihost AG
2012-11-23 14:11 ` Stefan Hajnoczi
2012-11-23 14:15 ` Peter Maydell
2012-11-23 14:38 ` Stefan Priebe - Profihost AG [this message]
2012-11-23 15:56 ` Stefan Hajnoczi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=50AF8A59.6060205@profihost.ag \
--to=s.priebe@profihost.ag \
--cc=ceph-devel@vger.kernel.org \
--cc=josh.durgin@inktank.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@gmail.com \
--cc=sw@weilnetz.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).