libiscsi/6000-iscsi-perf-fix-overflow-issue-in-fill_read_queue.patch
2019-09-30 10:56:47 -04:00

42 lines
1.1 KiB
Diff

From 63cfcd3384f6ab35a7d1f3d82dd824fb1872d657 Mon Sep 17 00:00:00 2001
From: optimistyzy <optimistyzy@gmail.com>
Date: Mon, 9 Jan 2017 18:34:12 +0800
Subject: [PATCH 035/110] iscsi-perf: fix overflow issue in fill_read_queue
If with int defintion, this statement:
num_blocks = client->num_blocks - client->pos;
May not get the exact value we want.
Signed-off-by: optimistyzy <optimistyzy@gmail.com>
---
utils/iscsi-perf.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/utils/iscsi-perf.c b/utils/iscsi-perf.c
index 14c3f49..7e0f145 100644
--- a/utils/iscsi-perf.c
+++ b/utils/iscsi-perf.c
@@ -186,7 +186,7 @@ out:
void fill_read_queue(struct client *client)
{
- int num_blocks;
+ int64_t num_blocks;
if (finished) return;
@@ -210,7 +210,7 @@ void fill_read_queue(struct client *client)
task = iscsi_read16_task(client->iscsi,
client->lun, client->pos,
- num_blocks * client->blocksize,
+ (uint32_t)(num_blocks * client->blocksize),
client->blocksize, 0, 0, 0, 0, 0,
cb, client);
if (task == NULL) {
--
1.8.3.1