1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
|
Description: Case return of tcmu_lba_to_byte to size_t
Ensures comparison of size_t types avoiding compilation
error under 32 bit architectures.
Author: James Page <james.page@ubuntu.com>
Forwarded: https://github.com/open-iscsi/tcmu-runner/pull/603
diff --git a/tcmur_cmd_handler.c b/tcmur_cmd_handler.c
index 132c668..a68e367 100644
--- a/tcmur_cmd_handler.c
+++ b/tcmur_cmd_handler.c
@@ -725,7 +725,7 @@ static int handle_writesame(struct tcmu_device *dev, struct tcmulib_cmd *cmd)
max_xfer_length = tcmu_dev_get_max_xfer_len(dev) * block_size;
length = round_up(length, max_xfer_length);
- length = min(length, tcmu_lba_to_byte(dev, lba_cnt));
+ length = min(length, (size_t)tcmu_lba_to_byte(dev, lba_cnt));
if (tcmur_cmd_state_init(tcmur_cmd, sizeof(*write_same), length)) {
tcmu_dev_err(dev, "Failed to calloc write_same data!\n");
|