[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-block] [RFC PATCH 51/56] block/nfs: Fix for readahead-size, page-c
From: |
Markus Armbruster |
Subject: |
[Qemu-block] [RFC PATCH 51/56] block/nfs: Fix for readahead-size, page-cache-size > INT64_MAX |
Date: |
Mon, 7 Aug 2017 16:45:55 +0200 |
nfs_client_open() implicitly converts the uint64_t value of
qemu_opt_get_number() to int64_t, then clamps it to range. The
clamping is broken for negative values.
Fix by making NFSClient members @readahead and @pagecache uint64_t.
Signed-off-by: Markus Armbruster <address@hidden>
---
block/nfs.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/block/nfs.c b/block/nfs.c
index d8db419..2776788 100644
--- a/block/nfs.c
+++ b/block/nfs.c
@@ -58,7 +58,8 @@ typedef struct NFSClient {
bool cache_used;
NFSServer *server;
char *path;
- int64_t uid, gid, tcp_syncnt, readahead, pagecache, debug;
+ int64_t uid, gid, tcp_syncnt, debug;
+ uint64_t readahead, pagecache;
} NFSClient;
typedef struct NFSRPC {
@@ -856,10 +857,10 @@ static void nfs_refresh_filename(BlockDriverState *bs,
QDict *options)
qdict_put_int(opts, "tcp-syn-cnt", client->tcp_syncnt);
}
if (client->readahead) {
- qdict_put_int(opts, "readahead-size", client->readahead);
+ qdict_put_uint(opts, "readahead-size", client->readahead);
}
if (client->pagecache) {
- qdict_put_int(opts, "page-cache-size", client->pagecache);
+ qdict_put_uint(opts, "page-cache-size", client->pagecache);
}
if (client->debug) {
qdict_put_int(opts, "debug", client->debug);
--
2.7.5
- [Qemu-block] [RFC PATCH 50/56] block: Make BLOCK_IMAGE_CORRUPTED offset, size unsigned in QAPI/QMP, (continued)
- [Qemu-block] [RFC PATCH 50/56] block: Make BLOCK_IMAGE_CORRUPTED offset, size unsigned in QAPI/QMP, Markus Armbruster, 2017/08/07
- [Qemu-block] [RFC PATCH 55/56] block: Make MapEntry offsets and size unsigned in QAPI, Markus Armbruster, 2017/08/07
- [Qemu-block] [RFC PATCH 56/56] crypto: Make QCryptoBlockInfoLUKS offsets unsigned in QAPI/QMP, Markus Armbruster, 2017/08/07
- [Qemu-block] [RFC PATCH 42/56] blockjob: Lift speed sign conversion out of stream_start(), Markus Armbruster, 2017/08/07
- [Qemu-block] [RFC PATCH 34/56] block: Make BlockDeviceStats sizes, offsets unsigned in QAPI/QMP, Markus Armbruster, 2017/08/07
- [Qemu-block] [RFC PATCH 14/56] migration: Fix migrate-set-cache-size error reporting, Markus Armbruster, 2017/08/07
- [Qemu-block] [RFC PATCH 47/56] blockjob: Make BlockJobInfo and event offsets unsigned in QAPI/QMP, Markus Armbruster, 2017/08/07
- [Qemu-block] [RFC PATCH 20/56] block: Make ImageInfo sizes unsigned in QAPI/QMP, Markus Armbruster, 2017/08/07
- [Qemu-block] [RFC PATCH 51/56] block/nfs: Fix for readahead-size, page-cache-size > INT64_MAX,
Markus Armbruster <=
- [Qemu-block] [RFC PATCH 53/56] block: Make blockdev-add byte counts unsigned in QAPI/QMP, Markus Armbruster, 2017/08/07
- [Qemu-block] [RFC PATCH 41/56] blockjob: Lift speed sign conversion out of mirror_start_job(), Markus Armbruster, 2017/08/07