migration/block: replace uses of blk_nb_sectors that do not check result
authorPaolo Bonzini <pbonzini@redhat.com>
Fri, 7 Apr 2023 15:33:00 +0000 (17:33 +0200)
committerKevin Wolf <kwolf@redhat.com>
Tue, 11 Apr 2023 14:40:53 +0000 (16:40 +0200)
commit2c5451ca523fc2b757e1e5b4e0b9fc84dbd58f97
treeb31834074a21b549780e99807535bb65dbb10994
parent8c6f27e7d85a794698eb1cd32c58df28cece50d1
migration/block: replace uses of blk_nb_sectors that do not check result

Uses of blk_nb_sectors must check whether the result is negative.
Otherwise, underflow can happen.  Fortunately, alloc_aio_bitmap()
and bmds_aio_inflight() both have an alternative way to retrieve the
number of sectors in the file.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Message-Id: <20230407153303.391121-6-pbonzini@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
migration/block.c