block: fix theoretical overflow in bdrv_init_padding()
commita56ed80c429610aecd6f74fbd4a9467f5466278a
authorVladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Fri, 11 Dec 2020 18:39:21 +0000 (11 21:39 +0300)
committerEric Blake <eblake@redhat.com>
Wed, 3 Feb 2021 14:00:33 +0000 (3 08:00 -0600)
tree0e15ac7e2d6d667282288ee1085cecaa99c4ff21
parent4c002cef0e9abe7135d7916c51abce47f7fc1ee2
block: fix theoretical overflow in bdrv_init_padding()

Calculation of sum may theoretically overflow, so use 64bit type and
add some good assertions.

Use int64_t constantly.

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Message-Id: <20201211183934.169161-4-vsementsov@virtuozzo.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
[eblake: tweak assertion order]
Signed-off-by: Eric Blake <eblake@redhat.com>
block/io.c