Skip to content

Commit 7242db6

Browse files
Vladimir Sementsov-Ogievskiyebblake
authored andcommitted
block-backend: blk_check_byte_request(): int64_t bytes
Rename size and make it int64_t to correspond to modern block layer, which always uses int64_t for offset and bytes (not in blk layer yet, which is a task for following commits). All callers pass int or unsigned int. So, for bytes in [0, INT_MAX] nothing is changed, for negative bytes we now fail on "bytes < 0" check instead of "bytes > INT_MAX" check. Note, that blk_check_byte_request() still doesn't allow requests exceeding INT_MAX. Signed-off-by: Vladimir Sementsov-Ogievskiy <[email protected]> Message-Id: <[email protected]> Reviewed-by: Eric Blake <[email protected]> Signed-off-by: Eric Blake <[email protected]>
1 parent e7e588d commit 7242db6

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

block/block-backend.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1161,11 +1161,11 @@ void blk_set_disable_request_queuing(BlockBackend *blk, bool disable)
11611161
}
11621162

11631163
static int blk_check_byte_request(BlockBackend *blk, int64_t offset,
1164-
size_t size)
1164+
int64_t bytes)
11651165
{
11661166
int64_t len;
11671167

1168-
if (size > INT_MAX) {
1168+
if (bytes < 0 || bytes > INT_MAX) {
11691169
return -EIO;
11701170
}
11711171

@@ -1183,7 +1183,7 @@ static int blk_check_byte_request(BlockBackend *blk, int64_t offset,
11831183
return len;
11841184
}
11851185

1186-
if (offset > len || len - offset < size) {
1186+
if (offset > len || len - offset < bytes) {
11871187
return -EIO;
11881188
}
11891189
}

0 commit comments

Comments
 (0)