kernel/ext2: Make sure we don't crash when accessing the last inode
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
f0a7098470
commit
d363d5e915
@ -27,7 +27,8 @@ namespace Ext2
|
|||||||
|
|
||||||
Result<SharedPtr<VFS::Inode>> FileSystem::find_inode_by_number(ino_t inum, bool initialize_dir_now)
|
Result<SharedPtr<VFS::Inode>> FileSystem::find_inode_by_number(ino_t inum, bool initialize_dir_now)
|
||||||
{
|
{
|
||||||
check(inum < m_superblock.nr_inodes);
|
// Inode numbers start at 1.
|
||||||
|
check(inum <= m_superblock.nr_inodes);
|
||||||
|
|
||||||
auto maybe_inode = m_inode_cache.try_get(inum);
|
auto maybe_inode = m_inode_cache.try_get(inum);
|
||||||
if (maybe_inode.has_value()) return maybe_inode.value();
|
if (maybe_inode.has_value()) return maybe_inode.value();
|
||||||
|
Loading…
Reference in New Issue
Block a user