summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Wolf2014-04-14 14:47:14 +0200
committerKevin Wolf2014-04-22 11:57:02 +0200
commit54db38a47978381e23e7f6479c31a97b5d352f7e (patch)
treea314e16120a6a5c8a6ce196befe29bf7e8c65351
parentMerge remote-tracking branch 'remotes/pmaydell/tags/pull-target-arm-20140417-... (diff)
downloadqemu-54db38a47978381e23e7f6479c31a97b5d352f7e.tar.gz
qemu-54db38a47978381e23e7f6479c31a97b5d352f7e.tar.xz
qemu-54db38a47978381e23e7f6479c31a97b5d352f7e.zip
block: Fix nb_sectors check in bdrv_check_byte_request()
nb_sectors is signed, check for negative values. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Max Reitz <mreitz@redhat.com>
-rw-r--r--block.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/block.c b/block.c
index 990a7542a9..3b7951eb4f 100644
--- a/block.c
+++ b/block.c
@@ -2601,7 +2601,7 @@ static int bdrv_check_byte_request(BlockDriverState *bs, int64_t offset,
static int bdrv_check_request(BlockDriverState *bs, int64_t sector_num,
int nb_sectors)
{
- if (nb_sectors > INT_MAX / BDRV_SECTOR_SIZE) {
+ if (nb_sectors < 0 || nb_sectors > INT_MAX / BDRV_SECTOR_SIZE) {
return -EIO;
}