diff --git a/src/add-ons/kernel/file_systems/ext2/Inode.cpp b/src/add-ons/kernel/file_systems/ext2/Inode.cpp index 4318466057..577c810837 100644 --- a/src/add-ons/kernel/file_systems/ext2/Inode.cpp +++ b/src/add-ons/kernel/file_systems/ext2/Inode.cpp @@ -32,10 +32,12 @@ Inode::Inode(Volume* volume, ino_t id) uint32 block; if (volume->GetInodeBlock(id, block) == B_OK) { TRACE("inode %Ld at block %lu\n", ID(), block); - ext2_inode* inodes = (ext2_inode*)block_cache_get(volume->BlockCache(), + uint8* inodeBlock = (uint8*)block_cache_get(volume->BlockCache(), block); - if (inodes != NULL) - fNode = inodes + volume->InodeBlockIndex(id); + if (inodeBlock != NULL) { + fNode = (ext2_inode*)(inodeBlock + volume->InodeBlockIndex(id) + * volume->InodeSize()); + } } if (fNode != NULL) { diff --git a/src/add-ons/kernel/file_systems/ext2/Volume.cpp b/src/add-ons/kernel/file_systems/ext2/Volume.cpp index 66d50ae70f..0a30ab77dc 100644 --- a/src/add-ons/kernel/file_systems/ext2/Volume.cpp +++ b/src/add-ons/kernel/file_systems/ext2/Volume.cpp @@ -297,7 +297,7 @@ Volume::Mount(const char* deviceName, uint32 flags) return B_NO_MEMORY; memset(fGroupBlocks, 0, blockCount * sizeof(void*)); - fInodesPerBlock = fBlockSize / sizeof(ext2_inode); + fInodesPerBlock = fBlockSize / InodeSize(); // check if the device size is large enough to hold the file system off_t diskSize;