summaryrefslogtreecommitdiffstats
path: root/block.c
diff options
context:
space:
mode:
authorKevin Wolf <kwolf@redhat.com>2014-04-14 14:47:14 +0200
committerKevin Wolf <kwolf@redhat.com>2014-04-22 11:57:02 +0200
commit54db38a47978381e23e7f6479c31a97b5d352f7e (patch)
treea314e16120a6a5c8a6ce196befe29bf7e8c65351 /block.c
parent2d03b49c3f225994c4b0b46146437d8c887d6774 (diff)
downloadhqemu-54db38a47978381e23e7f6479c31a97b5d352f7e.zip
hqemu-54db38a47978381e23e7f6479c31a97b5d352f7e.tar.gz
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>
Diffstat (limited to 'block.c')
-rw-r--r--block.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/block.c b/block.c
index 990a754..3b7951e 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;
}
OpenPOWER on IntegriCloud