On Wed, 5 Aug 2020 at 10:24, Tuguoyi <tu.gu...@h3c.com> wrote:
>
> When calculating the offset, the result of left shift operation will be 
> promoted
> to type int64 automatically because the left operand of + operator is 
> uint64_t.
> but the result after integer promotion may be produce an error value for us 
> and
> trigger the following asserting error.
>
> For example, consider i=0x2000, cluster_bits=18, the result of left shift
> operation will be 0x80000000. Cause argument i is of signed integer type,
> the result is automatically promoted to 0xffffffff80000000 which is not
> we expected
>
> The way to trigger the assertion error:
>   qemu-img create -f qcow2 -o preallocation=full,cluster_size=256k tmpdisk 10G
>
> This patch fix it by casting @i to uint64_t before doing left shift operation
>
> Signed-off-by: Guoyi Tu <tu.gu...@h3c.com>
> ---

Applied to master, thanks.

-- PMM

Reply via email to