Re: [Qemu-devel] [PATCH for-2.11] qcow2: Fix overly broad madvise()

2017-11-15 Thread Max Reitz
On 2017-11-14 19:41, Max Reitz wrote: > @mem_size and @offset are both size_t, thus subtracting them from one > another will just return a big size_t if mem_size < offset -- even more > obvious here because the result is stored in another size_t. > > Checking that result to be positive is

Re: [Qemu-devel] [PATCH for-2.11] qcow2: Fix overly broad madvise()

2017-11-15 Thread Max Reitz
On 2017-11-15 10:09, Alberto Garcia wrote: > On Tue 14 Nov 2017 07:41:27 PM CET, Max Reitz wrote: >> @mem_size and @offset are both size_t, thus subtracting them from one >> another will just return a big size_t if mem_size < offset -- even more >> obvious here because the result is stored in

Re: [Qemu-devel] [PATCH for-2.11] qcow2: Fix overly broad madvise()

2017-11-15 Thread Alberto Garcia
On Tue 14 Nov 2017 07:41:27 PM CET, Max Reitz wrote: > @mem_size and @offset are both size_t, thus subtracting them from one > another will just return a big size_t if mem_size < offset -- even more > obvious here because the result is stored in another size_t. > > Checking that result to be

Re: [Qemu-devel] [PATCH for-2.11] qcow2: Fix overly broad madvise()

2017-11-14 Thread Eric Blake
On 11/14/2017 12:41 PM, Max Reitz wrote: > @mem_size and @offset are both size_t, thus subtracting them from one > another will just return a big size_t if mem_size < offset -- even more > obvious here because the result is stored in another size_t. > > Checking that result to be positive is

[Qemu-devel] [PATCH for-2.11] qcow2: Fix overly broad madvise()

2017-11-14 Thread Max Reitz
@mem_size and @offset are both size_t, thus subtracting them from one another will just return a big size_t if mem_size < offset -- even more obvious here because the result is stored in another size_t. Checking that result to be positive is therefore not sufficient to excluse the case that