iblk stands for image-file block number. Its size is the same as u32. The size
of 'sector' is the same as long. While converting the former to the latter
like this: sec = iblk << shift, we must always cast 'iblk' to long. And we
actually do in most cases. The patch fixes a place in io_direct module where
it was forgotten.

https://jira.sw.ru/browse/PSBM-22961

Signed-off-by: Maxim Patlasov <mpatla...@parallels.com>
---
 drivers/block/ploop/io_direct.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/block/ploop/io_direct.c b/drivers/block/ploop/io_direct.c
index ab74849..56b9f37 100644
--- a/drivers/block/ploop/io_direct.c
+++ b/drivers/block/ploop/io_direct.c
@@ -119,8 +119,8 @@ dio_submit(struct ploop_io *io, struct ploop_request * preq,
                goto out_em_err;
 
        if (write && em->block_start == BLOCK_UNINIT) {
-               sector_t end = (iblk + 1) << preq->plo->cluster_log;
-               sec = iblk << preq->plo->cluster_log;
+               sector_t end = (sector_t)(iblk + 1) << preq->plo->cluster_log;
+               sec = (sector_t)iblk << preq->plo->cluster_log;
 
                if (em->start <= sec)
                        sec = em->end;
-- 
1.9.3

_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel

Reply via email to