The ext2_off_t and ext2_off64_t types are used by ext2_file_lseek()
and ext2_file_llseek(), and they need to be signed so that it can be a
negative offset from the end of the file when EXT2_SEEK_END is used.
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
errcode_t ext2fs_inode_size_set(ext2_filsys fs, struct ext2_inode *inode,
ext2_off64_t size)
{
+ if (size < 0)
+ return EINVAL;
+
/* Only regular files get to be larger than 4GB */
if (!LINUX_S_ISREG(inode->i_mode) && (size >> 32))
return EXT2_ET_FILE_TOO_BIG;
typedef __u32 __bitwise blk_t;
typedef __u64 __bitwise blk64_t;
typedef __u32 __bitwise dgrp_t;
-typedef __u32 __bitwise ext2_off_t;
-typedef __u64 __bitwise ext2_off64_t;
+typedef __s32 __bitwise ext2_off_t;
+typedef __s64 __bitwise ext2_off64_t;
typedef __s64 __bitwise e2_blkcnt_t;
typedef __u32 __bitwise ext2_dirhash_t;
!(ea_inode->i_flags & EXT4_EA_INODE_FL) ||
ea_inode->i_links_count == 0)
err = EXT2_ET_EA_INODE_CORRUPTED;
- else if (ext2fs_file_get_size(ea_file) !=
- entry->e_value_size)
+ else if ((__u64) ext2fs_file_get_size(ea_file) !=
+ entry->e_value_size)
err = EXT2_ET_EA_BAD_VALUE_SIZE;
else
err = ext2fs_file_read(ea_file, x->value,