|
From: | Eric Blake |
Subject: | Re: [Qemu-block] [Qemu-devel] [PULL 08/37] iscsi: Switch to .bdrv_co_block_status() |
Date: | Tue, 8 May 2018 11:38:28 -0500 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 |
On 05/08/2018 10:37 AM, Peter Maydell wrote:
On 2 March 2018 at 18:54, Kevin Wolf <address@hidden> wrote:From: Eric Blake <address@hidden> We are gradually moving away from sector-based interfaces, towards byte-based. Update the iscsi driver accordingly. In this case, it is handy to teach iscsi_co_block_status() to handle a NULL map and file parameter, even though the block layer passes non-NULL values, because we also call the function directly. For now, there are no optimizations done based on the want_zero flag.- *pnum = sector_lun2qemu(lbasd->num_blocks, iscsilun); + *pnum = lbasd->num_blocks * iscsilun->block_size;Hi; following this change Coverity complains (CID1390646) about this multiplication, which is a 32-bit multiply whose result is then put into a 64-bit result. Is it intended to be a 64-bit multiply ?
Hmm, good question. Before this patch, the block layer definitely capped things below 2G so that the multiply would not overflow; but in rewriting it to be byte-based, it also removed that cap. I'll send a patch to do a 64-bit multiply, just to be safe (even though I don't know for sure whether iscsi_get_lba_status_task can return more blocks than INT_MAX/block_size).
-- Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org
[Prev in Thread] | Current Thread | [Next in Thread] |