mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 06:32:44 +00:00 
			
		
		
		
	Kernel: Stop using unsigned when adjusting offsets in DiskPartition
These can only contain 32 bit values, and so will truncate very large offsets.
This commit is contained in:
		
							parent
							
								
									2065a73727
								
							
						
					
					
						commit
						b9cce82cf3
					
				
					 1 changed files with 4 additions and 4 deletions
				
			
		|  | @ -49,28 +49,28 @@ void DiskPartition::start_request(AsyncBlockDeviceRequest& request) | |||
| 
 | ||||
| ErrorOr<size_t> DiskPartition::read(OpenFileDescription& fd, u64 offset, UserOrKernelBuffer& outbuf, size_t len) | ||||
| { | ||||
|     unsigned adjust = m_metadata.start_block() * block_size(); | ||||
|     u64 adjust = m_metadata.start_block() * block_size(); | ||||
|     dbgln_if(OFFD_DEBUG, "DiskPartition::read offset={}, adjust={}, len={}", fd.offset(), adjust, len); | ||||
|     return m_device.strong_ref()->read(fd, offset + adjust, outbuf, len); | ||||
| } | ||||
| 
 | ||||
| bool DiskPartition::can_read(const OpenFileDescription& fd, u64 offset) const | ||||
| { | ||||
|     unsigned adjust = m_metadata.start_block() * block_size(); | ||||
|     u64 adjust = m_metadata.start_block() * block_size(); | ||||
|     dbgln_if(OFFD_DEBUG, "DiskPartition::can_read offset={}, adjust={}", offset, adjust); | ||||
|     return m_device.strong_ref()->can_read(fd, offset + adjust); | ||||
| } | ||||
| 
 | ||||
| ErrorOr<size_t> DiskPartition::write(OpenFileDescription& fd, u64 offset, const UserOrKernelBuffer& inbuf, size_t len) | ||||
| { | ||||
|     unsigned adjust = m_metadata.start_block() * block_size(); | ||||
|     u64 adjust = m_metadata.start_block() * block_size(); | ||||
|     dbgln_if(OFFD_DEBUG, "DiskPartition::write offset={}, adjust={}, len={}", offset, adjust, len); | ||||
|     return m_device.strong_ref()->write(fd, offset + adjust, inbuf, len); | ||||
| } | ||||
| 
 | ||||
| bool DiskPartition::can_write(const OpenFileDescription& fd, u64 offset) const | ||||
| { | ||||
|     unsigned adjust = m_metadata.start_block() * block_size(); | ||||
|     u64 adjust = m_metadata.start_block() * block_size(); | ||||
|     dbgln_if(OFFD_DEBUG, "DiskPartition::can_write offset={}, adjust={}", offset, adjust); | ||||
|     return m_device.strong_ref()->can_write(fd, offset + adjust); | ||||
| } | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Idan Horowitz
						Idan Horowitz