File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -208,8 +208,9 @@ int ScsiBlockCmds::read_capacity() {
208208 return ScsiPhase::STATUS;
209209 }
210210
211- uint32_t last_lba = this ->blk_dev ->get_size_in_blocks () - 1 ;
212- uint32_t blk_len = this ->blk_dev ->get_block_size ();
211+ uint32_t last_lba = (uint32_t )std::min (
212+ this ->blk_dev ->get_size_in_blocks () - 1 , 0xFFFFFFFFULL );
213+ uint32_t blk_len = this ->blk_dev ->get_block_size ();
213214
214215 WRITE_DWORD_BE_A (&this ->buf_ptr [0 ], last_lba);
215216 WRITE_DWORD_BE_A (&this ->buf_ptr [4 ], blk_len);
@@ -220,8 +221,8 @@ int ScsiBlockCmds::read_capacity() {
220221}
221222
222223int ScsiBlockCmds::format_block_descriptors (uint8_t * out_ptr) {
223- uint32_t nblocks = std::min (( int64_t ) this -> blk_dev -> get_size_in_blocks (),
224- ( int64_t ) 0xFFFFFFFFUL );
224+ uint32_t nblocks = ( uint32_t ) std::min (
225+ this -> blk_dev -> get_size_in_blocks (), 0xFFFFFFFFULL );
225226
226227 WRITE_DWORD_BE_A (&out_ptr[0 ], nblocks);
227228 WRITE_DWORD_BE_A (&out_ptr[4 ], (this ->density_code << 24 ) |
You can’t perform that action at this time.
0 commit comments