From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:54220) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TbuOp-0004nA-08 for qemu-devel@nongnu.org; Fri, 23 Nov 2012 09:38:39 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TbuOk-00028v-K8 for qemu-devel@nongnu.org; Fri, 23 Nov 2012 09:38:34 -0500 Received: from mail.profihost.ag ([85.158.179.208]:44483) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TbuOk-00028r-9E for qemu-devel@nongnu.org; Fri, 23 Nov 2012 09:38:30 -0500 Message-ID: <50AF8A59.6060205@profihost.ag> Date: Fri, 23 Nov 2012 15:38:17 +0100 From: Stefan Priebe - Profihost AG MIME-Version: 1.0 References: <1353575275-1343-1-git-send-email-s.priebe@profihost.ag> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] overflow of int ret: use ssize_t for ret List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell Cc: Stefan Hajnoczi , ceph-devel@vger.kernel.org, Stefan Weil , qemu-devel , Josh Durgin 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 wrote: >> On Thu, Nov 22, 2012 at 10:07 AM, Stefan Priebe 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 >