]> git.ipfire.org Git - thirdparty/qemu.git/commit
block/file-posix: Fix fully preallocated truncate
authorMax Reitz <mreitz@redhat.com>
Wed, 28 Feb 2018 13:13:14 +0000 (14:13 +0100)
committerMichael Roth <mdroth@linux.vnet.ibm.com>
Thu, 21 Jun 2018 01:45:01 +0000 (20:45 -0500)
commitd315353bed0ee4f4a505b8c5fdf24dc63659ae92
treedd8691f3764bf253da88c27429c6fca515ff2193
parent332969a64dde88c6ed6319a8d909c2de94966282
block/file-posix: Fix fully preallocated truncate

Storing the lseek() result in an int results in it overflowing when the
file is at least 2 GB big.  Then, we have a 50 % chance of the result
being "negative" and thus thinking an error occurred when actually
everything went just fine.

So we should use the correct type for storing the result: off_t.

Reported-by: Daniel P. Berrange <berrange@redhat.com>
Buglink: https://bugzilla.redhat.com/show_bug.cgi?id=1549231
Cc: qemu-stable@nongnu.org
Signed-off-by: Max Reitz <mreitz@redhat.com>
Message-id: 20180228131315.30194-2-mreitz@redhat.com
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Max Reitz <mreitz@redhat.com>
(cherry picked from commit 82b45e0a0b824787bd79ce3f6453eaa2afddd138)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
block/file-posix.c