Some of these could affect filesystems between 2^31 and 2^32-1 blocks.
Thanks to Valerie Aurora Henson for pointing out the problems in
lib/ext2fs/alloc_tables.c, which led me to do a "make gcc-wall" scan
over the source tree.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
const char *old_op;
errcode_t retval;
blk_t blk;
- int i, rec_len, not_device = 0;
+ unsigned int i, rec_len, not_device = 0;
if (LINUX_S_ISDIR(inode->i_mode) || LINUX_S_ISREG(inode->i_mode) ||
LINUX_S_ISLNK(inode->i_mode) || inode->i_block[0] == 0)
bad_size = 4;
else if ((extent_fs && (inode->i_flags & EXT4_EXTENTS_FL)) &&
size >
- ((1LL << (32 + EXT2_BLOCK_SIZE_BITS(fs->super))) - 1))
+ ((1ULL << (32 + EXT2_BLOCK_SIZE_BITS(fs->super))) - 1))
/* too big for an extent-based file - 32bit ee_block */
bad_size = 6;
}
const char * old_op;
int dir_modified = 0;
int dot_state;
- int rec_len;
+ unsigned int rec_len;
blk_t block_nr = db->blk;
ext2_ino_t ino = db->ino;
ext2_ino_t subdir_parent;
if (((offset + rec_len) > fs->blocksize) ||
(rec_len < 12) ||
((rec_len % 4) != 0) ||
- (((dirent->name_len & 0xFF)+8) > rec_len)) {
+ (((dirent->name_len & (unsigned) 0xFF)+8) > rec_len)) {
if (fix_problem(ctx, PR_2_DIR_CORRUPTED, &cd->pctx)) {
salvage_directory(fs, dirent, prev, &offset);
dir_modified++;
/*
* Check for uninit block bitmaps and deal with them appropriately
*/
-static check_block_uninit(ext2_filsys fs, ext2fs_block_bitmap map,
+static void check_block_uninit(ext2_filsys fs, ext2fs_block_bitmap map,
dgrp_t group)
{
- int i;
+ blk_t i;
blk_t blk, super_blk, old_desc_blk, new_desc_blk;
int old_desc_blocks;
/*
* Check for uninit inode bitmaps and deal with them appropriately
*/
-static check_inode_uninit(ext2_filsys fs, ext2fs_inode_bitmap map,
+static void check_inode_uninit(ext2_filsys fs, ext2fs_inode_bitmap map,
dgrp_t group)
{
- int i;
- ext2_ino_t ino;
+ ext2_ino_t i, ino;
if (!(EXT2_HAS_RO_COMPAT_FEATURE(fs->super,
EXT4_FEATURE_RO_COMPAT_GDT_CSUM)) ||
start_blk = group_blk;
if (flexbg_size) {
- int prev_block = 0;
+ blk_t prev_block = 0;
if (group && fs->group_desc[group-1].bg_block_bitmap)
prev_block = fs->group_desc[group-1].bg_block_bitmap;
start_blk = flexbg_offset(fs, group, prev_block, bmap,
}
if (flexbg_size) {
- int prev_block = 0;
+ blk_t prev_block = 0;
if (group && fs->group_desc[group-1].bg_inode_bitmap)
prev_block = fs->group_desc[group-1].bg_inode_bitmap;
start_blk = flexbg_offset(fs, group, prev_block, bmap,
#if HAVE_ERRNO_H
#include <errno.h>
#endif
+#include <time.h>
#if HAVE_SYS_STAT_H
#include <sys/stat.h>
#endif
*/
static void fix_uninit_block_bitmaps(ext2_filsys fs)
{
- int i;
- blk_t blk, super_blk, old_desc_blk, new_desc_blk;
+ blk_t i, blk, super_blk, old_desc_blk, new_desc_blk;
int old_desc_blocks;
dgrp_t g;
struct istruct {
ext2_resize_t rfs;
errcode_t err;
- unsigned long max_dirs;
- int num;
+ unsigned int max_dirs;
+ unsigned int num;
};
static int check_and_change_inodes(ext2_ino_t dir,