Re: [Qemu-devel] [PATCH] qcow2: Fix alloc_clusters_noref() overflow detection

2014-05-05 Thread Max Reitz
On 05.05.2014 11:36, Kevin Wolf wrote: Am 04.05.2014 um 05:31 hat Max Reitz geschrieben: If the very first allocation has a length of 0, the free_cluster_index is still 0 after the for loop, which means that subtracting one from it will underflow and signal an invalid range of clusters by return

Re: [Qemu-devel] [PATCH] qcow2: Fix alloc_clusters_noref() overflow detection

2014-05-05 Thread Stefan Hajnoczi
On Sun, May 04, 2014 at 05:31:40AM +0200, Max Reitz wrote: > If the very first allocation has a length of 0, the free_cluster_index > is still 0 after the for loop, which means that subtracting one from it > will underflow and signal an invalid range of clusters by returning > -EFBIG. However, ther

Re: [Qemu-devel] [PATCH] qcow2: Fix alloc_clusters_noref() overflow detection

2014-05-05 Thread Kevin Wolf
Am 04.05.2014 um 05:31 hat Max Reitz geschrieben: > If the very first allocation has a length of 0, the free_cluster_index > is still 0 after the for loop, which means that subtracting one from it > will underflow and signal an invalid range of clusters by returning > -EFBIG. However, there is no s

[Qemu-devel] [PATCH] qcow2: Fix alloc_clusters_noref() overflow detection

2014-05-03 Thread Max Reitz
If the very first allocation has a length of 0, the free_cluster_index is still 0 after the for loop, which means that subtracting one from it will underflow and signal an invalid range of clusters by returning -EFBIG. However, there is no such range, as its length is 0. Fix this by preventing und