summaryrefslogtreecommitdiff
path: root/Kernel/Storage
diff options
context:
space:
mode:
authorIdan Horowitz <idan.horowitz@gmail.com>2022-01-25 20:17:49 +0200
committerIdan Horowitz <idan.horowitz@gmail.com>2022-01-25 22:41:17 +0200
commit9ce537d7036bf4aff61d4ce10e7fe0b134c122b3 (patch)
tree3dc45992db0acbfad56c0555821909432a1f86cd /Kernel/Storage
parent0c630d568721f1efba2d5c0ee72c52c08b43d6e8 (diff)
downloadserenity-9ce537d7036bf4aff61d4ce10e7fe0b134c122b3.zip
Kernel: Use u64 instead of size_t for File::can_read offset
This ensures offsets will not be truncated on large files on i686.
Diffstat (limited to 'Kernel/Storage')
-rw-r--r--Kernel/Storage/Partition/DiskPartition.cpp2
-rw-r--r--Kernel/Storage/Partition/DiskPartition.h2
-rw-r--r--Kernel/Storage/StorageDevice.h2
3 files changed, 3 insertions, 3 deletions
diff --git a/Kernel/Storage/Partition/DiskPartition.cpp b/Kernel/Storage/Partition/DiskPartition.cpp
index 2e81fc9914..2a294033de 100644
--- a/Kernel/Storage/Partition/DiskPartition.cpp
+++ b/Kernel/Storage/Partition/DiskPartition.cpp
@@ -54,7 +54,7 @@ ErrorOr<size_t> DiskPartition::read(OpenFileDescription& fd, u64 offset, UserOrK
return m_device.strong_ref()->read(fd, offset + adjust, outbuf, len);
}
-bool DiskPartition::can_read(const OpenFileDescription& fd, size_t offset) const
+bool DiskPartition::can_read(const OpenFileDescription& fd, u64 offset) const
{
unsigned adjust = m_metadata.start_block() * block_size();
dbgln_if(OFFD_DEBUG, "DiskPartition::can_read offset={}, adjust={}", offset, adjust);
diff --git a/Kernel/Storage/Partition/DiskPartition.h b/Kernel/Storage/Partition/DiskPartition.h
index 8c3e1ec6c1..92412d2c2f 100644
--- a/Kernel/Storage/Partition/DiskPartition.h
+++ b/Kernel/Storage/Partition/DiskPartition.h
@@ -24,7 +24,7 @@ public:
// ^BlockDevice
virtual ErrorOr<size_t> read(OpenFileDescription&, u64, UserOrKernelBuffer&, size_t) override;
- virtual bool can_read(const OpenFileDescription&, size_t) const override;
+ virtual bool can_read(const OpenFileDescription&, u64) const override;
virtual ErrorOr<size_t> write(OpenFileDescription&, u64, const UserOrKernelBuffer&, size_t) override;
virtual bool can_write(const OpenFileDescription&, size_t) const override;
diff --git a/Kernel/Storage/StorageDevice.h b/Kernel/Storage/StorageDevice.h
index 4f3555e0bc..53ad1d750e 100644
--- a/Kernel/Storage/StorageDevice.h
+++ b/Kernel/Storage/StorageDevice.h
@@ -38,7 +38,7 @@ public:
// ^BlockDevice
virtual ErrorOr<size_t> read(OpenFileDescription&, u64, UserOrKernelBuffer&, size_t) override;
- virtual bool can_read(const OpenFileDescription&, size_t) const override;
+ virtual bool can_read(const OpenFileDescription&, u64) const override;
virtual ErrorOr<size_t> write(OpenFileDescription&, u64, const UserOrKernelBuffer&, size_t) override;
virtual bool can_write(const OpenFileDescription&, size_t) const override;
virtual void prepare_for_unplug() { m_partitions.clear(); }