Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset 41998ec in mainline


Ignore:
Timestamp:
2012-02-26T15:08:03Z (10 years ago)
Author:
Frantisek Princ <frantisek.princ@…>
Branches:
lfn, master
Children:
412f813
Parents:
1d68621
Message:

added one assert for more security

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/ext4/libext4_directory.c

    r1d68621 r41998ec  
    268268        uint64_t inode_size = ext4_inode_get_size(fs->superblock, inode_ref->inode);
    269269        uint32_t block_size = ext4_superblock_get_block_size(fs->superblock);
     270
     271        assert(inode_size % block_size == 0);
     272
     273        // Logical blocks are numbered from 0
    270274        uint32_t new_block_idx = inode_size / block_size;
    271275
     
    282286        }
    283287
    284         inode_size += block_size;
    285         ext4_inode_set_size(inode_ref->inode, inode_size);
     288        ext4_inode_set_size(inode_ref->inode, inode_size + block_size);
    286289
    287290        inode_ref->dirty = true;
Note: See TracChangeset for help on using the changeset viewer.