diff options
Diffstat (limited to 'drivers/target')
-rw-r--r-- | drivers/target/target_core_cdb.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/target/target_core_cdb.c b/drivers/target/target_core_cdb.c index 366080baf474..7f19c8b7b84c 100644 --- a/drivers/target/target_core_cdb.c +++ b/drivers/target/target_core_cdb.c | |||
@@ -667,7 +667,13 @@ target_emulate_readcapacity(struct se_cmd *cmd) | |||
667 | { | 667 | { |
668 | struct se_device *dev = SE_DEV(cmd); | 668 | struct se_device *dev = SE_DEV(cmd); |
669 | unsigned char *buf = cmd->t_task->t_task_buf; | 669 | unsigned char *buf = cmd->t_task->t_task_buf; |
670 | u32 blocks = dev->transport->get_blocks(dev); | 670 | unsigned long long blocks_long = dev->transport->get_blocks(dev); |
671 | u32 blocks; | ||
672 | |||
673 | if (blocks_long >= 0x00000000ffffffff) | ||
674 | blocks = 0xffffffff; | ||
675 | else | ||
676 | blocks = (u32)blocks_long; | ||
671 | 677 | ||
672 | buf[0] = (blocks >> 24) & 0xff; | 678 | buf[0] = (blocks >> 24) & 0xff; |
673 | buf[1] = (blocks >> 16) & 0xff; | 679 | buf[1] = (blocks >> 16) & 0xff; |