On 05/08/2018 10:37 AM, Peter Maydell wrote:
On 2 March 2018 at 18:54, Kevin Wolf <[email protected]> wrote:
From: Eric Blake <[email protected]>
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