qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] Is the use of bdrv_getlength() in parallels.c kosher?


From: Denis V. Lunev
Subject: Re: [Qemu-devel] Is the use of bdrv_getlength() in parallels.c kosher?
Date: Fri, 4 Aug 2017 16:10:40 +0300
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1

On 08/04/2017 03:31 PM, Markus Armbruster wrote:
> Same question for allocate_clusters() in parallels.c, commit 5a41e1f,
> modified in commit ddd2ef2:
>
>     if (s->data_end + space > bdrv_getlength(bs->file->bs) >> 
> BDRV_SECTOR_BITS) {
>
> bdrv_getlength() can fail.  Does it do the right thing then?  For what
> it's worth, the comparison of its value is signed.
>
> There's another one in parallels_open():
>
>     if (!(flags & BDRV_O_RESIZE) || !bdrv_has_zero_init(bs->file->bs) ||
>             bdrv_truncate(bs->file, bdrv_getlength(bs->file->bs),
>                           PREALLOC_MODE_OFF, NULL) != 0) {
>         s->prealloc_mode = PRL_PREALLOC_MODE_FALLOCATE;
>     }
the same as in the previous letter. Saniti checks will not harm.
I'll make a patch.

Thank you for the suggestion.

Den



reply via email to

[Prev in Thread] Current Thread [Next in Thread]