diff options
author | Kevin Wolf <kwolf@redhat.com> | 2014-04-14 14:47:14 +0200 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2014-04-22 11:57:02 +0200 |
commit | 54db38a47978381e23e7f6479c31a97b5d352f7e (patch) | |
tree | a314e16120a6a5c8a6ce196befe29bf7e8c65351 /block.c | |
parent | 2d03b49c3f225994c4b0b46146437d8c887d6774 (diff) |
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.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -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; } |