libext2fs: fix gcc -Wall warnings
PATCH 1/3 libext2fs: fix gcc -Wall warnings
Primarily signed vs unsigned and const warnings.
Signed-off-by "Theodore Ts'o" <[email protected]>
--- debian/e2fslibs.symbols | 1 - lib/ext2fs/bitops.c | 2 +- lib/ext2fs/bitops.h | 19 ++++++++----------- lib/ext2fs/blkmap64_rb.c | 48 ++++++++++++++++++++++++++++------------------- lib/ext2fs/block.c | 4 ++-- lib/ext2fs/crc32c.c | 8 ++++---- lib/ext2fs/gen_bitmap64.c | 2 +- lib/ext2fs/mmp.c | 3 ++- lib/ext2fs/rbtree.c | 4 ++-- lib/ext2fs/rbtree.h | 4 ++-- lib/ext2fs/rw_bitmaps.c | 3 ++- lib/ext2fs/symlink.c | 2 +- 12 files changed, 54 insertions(+), 46 deletions(-)
debian/e2fslibs.symbols +0 -1
@@ -352,7 +352,6 @@ libext2fs.so.2 e2fslibs #MINVER# ext2fs_open_file@Base 1.42 ext2fs_open_inode_scan@Base 1.37 ext2fs_parse_version_string@Base 1.37 - ext2fs_print_bmap_statistics@Base 1.42.1 ext2fs_process_dir_block@Base 1.37 ext2fs_punch@Base 1.42 ext2fs_r_blocks_count@Base 1.42
lib/ext2fs/bitops.c +1 -1
@@ -142,7 +142,7 @@ unsigned int ext2fs_bitcount(const void *addr, unsigned int nbytes) res +=popcount8 (*cp++); nbytes--; } - p = (__u32 *) cp; + p = (const __u32 *) cp;while (nbytes >4 ) { res +=popcount32 (*p++);
lib/ext2fs/bitops.h +8 -11
@@ -54,6 +54,14 @@ extern void ext2fs_warn_bitmap2(ext2fs_generic_bitmap bitmap, int code, unsigned long arg);#ifdef NO_INLINE_FUNCS +extern void ext2fs_fast_set_bit (unsigned int nr,void * addr); +extern void ext2fs_fast_clear_bit (unsigned int nr,void * addr); +extern void ext2fs_fast_set_bit64 (__u64 nr,void * addr); +extern void ext2fs_fast_clear_bit64 (__u64 nr,void * addr); +extern __u16 ext2fs_swab16 (__u16 val); +extern __u32 ext2fs_swab32 (__u32 val); +extern __u64 ext2fs_swab64 (__u64 val); +extern int ext2fs_mark_block_bitmap (ext2fs_block_bitmap bitmap,blk_t block);extern int ext2fs_unmark_block_bitmap (ext2fs_block_bitmap bitmap,blk_t block);
@@ -650,14 +658,3 @@ extern int ext2fs_set_bit64(__u64 nr,void * addr);extern int ext2fs_clear_bit64 (__u64 nr,void * addr);extern int ext2fs_test_bit64 (__u64 nr,const void * addr);extern unsigned int ext2fs_bitcount (const void *addr,unsigned int nbytes); - -#ifdef NO_INLINE_FUNCS -extern void ext2fs_fast_set_bit (unsigned int nr,void * addr); -extern void ext2fs_fast_clear_bit (unsigned int nr,void * addr); -extern void ext2fs_fast_set_bit64 (__u64 nr,void * addr); -extern void ext2fs_fast_clear_bit64 (__u64 nr,void * addr); -extern __u16 ext2fs_swab16 (__u16 val); -extern __u32 ext2fs_swab32 (__u32 val); -extern __u64 ext2fs_swab64 (__u64 val); -#endif -
lib/ext2fs/blkmap64_rb.c +29 -19
162 lines not on this page · raw message
lib/ext2fs/block.c +2 -2
@@ -472,9 +472,9 @@ errcode_t ext2fs_block_iterate3(ext2_filsys fs, extent.e_lblk, extent.e_pblk, extent.e_len, blockcnt);#endif -if (extent.e_lblk + extent.e_len <= blockcnt) +if (extent.e_lblk + extent.e_len <= (blk64_t ) blockcnt)continue ; -if (extent.e_lblk > blockcnt) +if (extent.e_lblk > (blk64_t ) blockcnt) blockcnt = extent.e_lblk; j = blockcnt - extent.e_lblk; blk += j;
lib/ext2fs/crc32c.c +4 -4
@@ -224,7 +224,7 @@ static uint32_t crc32c_le_body(uint32_t crc, uint8_t const *buf, size_t len) crc = (__force uint32_t )__cpu_to_le32 (crc); p8 = buf; - p32 = (uint32_t *)PTR_ALIGN (p8,8 ); + p32 = (const uint32_t *)PTR_ALIGN (p8,8 ); init_bytes =min ((uintptr_t )p32 - (uintptr_t )p8, len); words = (len - init_bytes) >>3 ; end_bytes = (len - init_bytes) &7 ;
@@ -273,7 +273,7 @@ static uint32_t crc32c_le_body(uint32_t crc, uint8_t const *buf, size_t len)#endif } - p8 = (uint8_t *)(++p32); + p8 = (const uint8_t *)(++p32);for (i =0 ; i < end_bytes; i++) {#ifndef WORDS_BIGENDIAN
@@ -304,7 +304,7 @@ static uint32_t crc32c_be_body(uint32_t crc, uint8_t const *buf, size_t len) crc = (__force uint32_t )__cpu_to_be32 (crc); p8 = buf; - p32 = (uint32_t *)PTR_ALIGN (p8,8 ); + p32 = (const uint32_t *)PTR_ALIGN (p8,8 ); init_bytes =min ((uintptr_t )p32 - (uintptr_t )p8, len); words = (len - init_bytes) >>3 ; end_bytes = (len - init_bytes) &7 ;
@@ -353,7 +353,7 @@ static uint32_t crc32c_be_body(uint32_t crc, uint8_t const *buf, size_t len)#endif } - p8 = (uint8_t *)(++p32); + p8 = (const uint8_t *)(++p32);for (i =0 ; i < end_bytes; i++) {#ifndef WORDS_BIGENDIAN
lib/ext2fs/gen_bitmap64.c +1 -1
@@ -174,7 +174,7 @@ errcode_t ext2fs_alloc_generic_bmap(ext2_filsys fs, errcode_t magic, }#ifdef BMAP_STATS -void ext2fs_print_bmap_statistics (ext2fs_generic_bitmap bitmap) +static void ext2fs_print_bmap_statistics (ext2fs_generic_bitmap bitmap) {struct ext2_bmap_statistics *stats = &bitmap->stats;#ifdef BMAP_STATS_OPS
lib/ext2fs/mmp.c +2 -1
@@ -62,7 +62,8 @@ errcode_t ext2fs_mmp_read(ext2_filsys fs, blk64_t mmp_blk, void *buf)return retval; } -if (ext2fs_llseek (fs->mmp_fd, mmp_blk * fs->blocksize,SEEK_SET ) != +if ((blk64_t )ext2fs_llseek (fs->mmp_fd, mmp_blk * fs->blocksize, +SEEK_SET ) != mmp_blk * fs->blocksize) { retval =EXT2_ET_LLSEEK_FAILED ; goto out;
lib/ext2fs/rbtree.c +2 -2
@@ -375,7 +375,7 @@ struct rb_node *ext2fs_rb_last(const struct rb_root *root)return n; } -struct rb_node *ext2fs_rb_next (const struct rb_node *node) +struct rb_node *ext2fs_rb_next (struct rb_node *node) {struct rb_node *parent;
@@ -403,7 +403,7 @@ struct rb_node *ext2fs_rb_next(const struct rb_node *node)return parent; } -struct rb_node *ext2fs_rb_prev (const struct rb_node *node) +struct rb_node *ext2fs_rb_prev (struct rb_node *node) {struct rb_node *parent;
lib/ext2fs/rbtree.h +2 -2
@@ -158,8 +158,8 @@ extern void ext2fs_rb_augment_erase_end(struct rb_node *node, rb_augment_f func, void *data);/* Find logical next and previous nodes in a tree */ -extern struct rb_node *ext2fs_rb_next (const struct rb_node *); -extern struct rb_node *ext2fs_rb_prev (const struct rb_node *); +extern struct rb_node *ext2fs_rb_next (struct rb_node *); +extern struct rb_node *ext2fs_rb_prev (struct rb_node *);extern struct rb_node *ext2fs_rb_first (const struct rb_root *);extern struct rb_node *ext2fs_rb_last (const struct rb_root *);
lib/ext2fs/rw_bitmaps.c +2 -1
@@ -163,7 +163,8 @@ static errcode_t read_bitmaps(ext2_filsys fs, int do_inode, int do_block)EXT2_CHECK_MAGIC (fs,EXT2_ET_MAGIC_EXT2FS_FILSYS ); -if ((block_nbytes > fs->blocksize) || (inode_nbytes > fs->blocksize)) +if ((block_nbytes > (int ) fs->blocksize) || + (inode_nbytes > (int ) fs->blocksize))return EXT2_ET_CORRUPT_SUPERBLOCK ; fs->write_bitmaps = ext2fs_write_bitmaps;
lib/ext2fs/symlink.c +1 -1
@@ -37,7 +37,7 @@ errcode_t ext2fs_symlink(ext2_filsys fs, ext2_ino_t parent, ext2_ino_t ino,ext2_ino_t scratch_ino;blk64_t blk;int fastlink; -int target_len; +unsigned int target_len;char *block_buf =0 ;EXT2_CHECK_MAGIC (fs,EXT2_ET_MAGIC_EXT2FS_FILSYS );
Signature · 1 line
1.7.12.rc0.22.gcdd159b
PATCH 2/3 misc: fix gcc -Wall warnings
Signed-off-by "Theodore Ts'o" <[email protected]>
--- lib/quota/quotaio.h | 5 ----- lib/quota/quotaio_tree.c | 5 +++++ misc/badblocks.c | 16 ++++++++-------- misc/e2image.c | 2 +- misc/filefrag.c | 6 +++--- misc/mke2fs.c | 45 ++++++++++++++++++++++----------------------- misc/tune2fs.c | 25 +++++++++++++------------ 7 files changed, 52 insertions(+), 52 deletions(-)
lib/quota/quotaio.h +0 -5
@@ -132,11 +132,6 @@ struct quotafile_ops {/* This might go into a special header file but that sounds a bit silly... */ extern struct quotafile_ops quotafile_ops_meta; -static inline void mark_quotafile_info_dirty (struct quota_handle *h) -{ - h->qh_io_flags |=IOFL_INFODIRTY ; -} -/* Open existing quotafile of given type (and verify its format) on given * filesystem. */ errcode_t quota_file_open(struct quota_handle *h, ext2_filsys fs,
lib/quota/quotaio_tree.c +5 -0
@@ -53,6 +53,11 @@ static int get_index(qid_t id, int depth)return (id >> ((QT_TREEDEPTH - depth -1 ) *8 )) &0xff ; } +static inline void mark_quotafile_info_dirty (struct quota_handle *h) +{ + h->qh_io_flags |=IOFL_INFODIRTY ; +} +/* Read given block */ static void read_blk (struct quota_handle *h,uint blk,dqbuf_t buf) {
misc/badblocks.c +8 -8
@@ -557,7 +557,7 @@ static unsigned int test_ro (int dev, blk_t last_block, currently_testing += got;if (got != try) { try =1 ; -if (recover_block == ~0 ) +if (recover_block == ~0U ) recover_block = currently_testing - got + blocks_at_once;continue ;
@@ -647,7 +647,7 @@ static unsigned int test_rw (int dev, blk_t last_block, currently_testing += got;if (got != try) { try =1 ; -if (recover_block == ~0 ) +if (recover_block == ~0U ) recover_block = currently_testing - got + blocks_at_once;continue ;
@@ -686,13 +686,13 @@ static unsigned int test_rw (int dev, blk_t last_block, currently_testing += got;if (got != try) { try =1 ; -if (recover_block == ~0 ) +if (recover_block == ~0U ) recover_block = currently_testing - got + blocks_at_once;continue ; }else if (currently_testing == recover_block) { try = blocks_at_once; - recover_block = ~0 ; + recover_block = ~0U ; }for (i=0 ; i < got; i++) { if (memcmp(read_buffer + i * block_size,
@@ -739,8 +739,8 @@ static unsigned int test_nd (int dev, blk_t last_block,errcode_t errcode;unsigned long buf_used;static unsigned int bb_count; -int granularity = blocks_at_once; -blk_t recover_block = ~0 ; +unsigned int granularity = blocks_at_once; +blk_t recover_block = ~0U ; bb_count =0 ; errcode =ext2fs_badblocks_list_iterate_begin (bb_list,&bb_iter);
@@ -839,7 +839,7 @@ static unsigned int test_nd (int dev, blk_t last_block, got =do_read (dev, save_ptr, try, block_size, currently_testing);if (got ==0 ) { -if (recover_block == ~0 ) +if (recover_block == ~0U ) recover_block = currently_testing + blocks_at_once;if (granularity !=1 ) {
@@ -874,7 +874,7 @@ static unsigned int test_nd (int dev, blk_t last_block, currently_testing += got;if (got != try) { try =1 ; -if (recover_block == ~0 ) +if (recover_block == ~0U ) recover_block = currently_testing - got + blocks_at_once;continue ;
misc/e2image.c +1 -1
@@ -453,7 +453,7 @@ static void scramble_dir_block(ext2_filsys fs, blk64_t blk, char *buf)#endif continue ; } -if (dirent->name_len +8 > rec_len) { +if (dirent->name_len +8U > rec_len) {printf ("Corrupt directory block %lu: " "bad name_len (%d)\n" , (unsigned long ) blk, dirent->name_len);
misc/filefrag.c +3 -3
@@ -52,8 +52,8 @@ int force_bmap; /* force use of FIBMAP instead of FIEMAP */int force_extent;/* print output in extent format always */ int logical_width =8 ;int physical_width =10 ; -char *ext_fmt ="%4d: %*llu..%*llu: %*llu..%*llu: %6llu: %s\n" ; -char *hex_fmt ="%4d: %*llx..%*llx: %*llx..%*llx: %6llx: %s\n" ; +const char *ext_fmt ="%4d: %*llu..%*llu: %*llu..%*llu: %6llu: %s\n" ; +const char *hex_fmt ="%4d: %*llx..%*llx: %*llx..%*llx: %6llx: %s\n" ;#define FILEFRAG_FIEMAP_FLAGS_COMPAT (FIEMAP_FLAG_SYNC | FIEMAP_FLAG_XATTR)
@@ -166,7 +166,7 @@ static void print_extent_info(struct fiemap_extent *fm_extent, int cur_ex,if (fm_extent->fe_flags &FIEMAP_EXTENT_MERGED )strcat (flags,"merged," ); -if (fm_extent->fe_logical + fm_extent->fe_length >= st->st_size) +if (fm_extent->fe_logical + fm_extent->fe_length >= (__u64 ) st->st_size)strcat (flags,"eof," );/* Remove trailing comma, if any */
misc/mke2fs.c +22 -23
148 lines not on this page · raw message
misc/tune2fs.c +13 -12
@@ -375,7 +375,8 @@ static int update_feature_set(ext2_filsys fs, char *features)struct ext2_super_block *sb = fs->super;struct ext2_group_desc *gd;__u32 old_features[3 ]; -int i, type_err; +dgrp_t i; +int type_err;unsigned int mask_err;#define FEATURE_ON (type, mask) (!(old_features[(type)] & (mask)) && \
@@ -701,7 +702,7 @@ err:return 1 ; } -void handle_quota_options (ext2_filsys fs) +static void handle_quota_options (ext2_filsys fs) {quota_ctx_t qctx;ext2_ino_t qf_ino;
@@ -751,7 +752,7 @@ void handle_quota_options(ext2_filsys fs)return ; } -void parse_quota_opts (const char *opts) +static void parse_quota_opts (const char *opts) {char *buf, *token, *next, *p;int len;
@@ -1153,12 +1154,12 @@ static int parse_extended_opts(ext2_filsys fs, const char *opts) strcmp(token, "clear_mmp") == 0) { clear_mmp =1 ; } else if (strcmp(token, "mmp_update_interval") == 0) { - unsigned long interval; + unsigned long intv; if (!arg) { r_usage++; continue; } - interval = strtoul(arg, &p, 0); + intv = strtoul(arg, &p, 0); if (*p) { fprintf(stderr, _("Invalid mmp_update_interval: %s\n"),
@@ -1166,21 +1167,21 @@ static int parse_extended_opts(ext2_filsys fs, const char *opts) r_usage++;continue ; } -if (interval ==0 ) { - interval =EXT4_MMP_UPDATE_INTERVAL ; - }else if (interval >EXT4_MMP_MAX_UPDATE_INTERVAL ) { +if (intv ==0 ) { + intv =EXT4_MMP_UPDATE_INTERVAL ; + }else if (intv >EXT4_MMP_MAX_UPDATE_INTERVAL ) {fprintf (stderr,_ ("mmp_update_interval too big: %lu\n" ), - interval); + intv); r_usage++;continue ; }printf (P_ ("Setting multiple mount protection update " "interval to %lu second\n" ,"Setting multiple mount protection update " -"interval to %lu seconds\n" , interval), - interval); - fs->super->s_mmp_update_interval = interval; +"interval to %lu seconds\n" , intv), + intv); + fs->super->s_mmp_update_interval = intv;ext2fs_mark_super_dirty (fs); }else if (!strcmp (token,"test_fs" )) { fs->super->s_flags |=EXT2_FLAGS_TEST_FILESYS ;
Signature · 1 line
1.7.12.rc0.22.gcdd159b
PATCH 3/3 e2fsck: fix gcc -Wall nits
In reply to Theodore Ts'oPerhaps the most serious fix up is a type-punning warning which could result in miscompilation with overly enthusiastic compilers.
Signed-off-by "Theodore Ts'o" <[email protected]>
--- e2fsck/journal.c | 2 +- e2fsck/message.c | 3 +-- e2fsck/pass1.c | 15 ++++++++------- e2fsck/pass1b.c | 35 ++++++++++++++++++----------------- e2fsck/pass2.c | 2 +- e2fsck/recovery.c | 16 ++++++++++------ e2fsck/rehash.c | 9 ++++----- e2fsck/sigcatcher.c | 3 ++- e2fsck/super.c | 2 +- 9 files changed, 46 insertions(+), 41 deletions(-)
e2fsck/journal.c +1 -1
@@ -314,7 +314,7 @@ static errcode_t e2fsck_get_journal(e2fsck_t ctx, journal_t **ret_journal)BLOCK_FLAG_HOLE ,0 , process_journal_block, &pb);if ((pb.last_block +1 ) * ctx->fs->blocksize < -EXT2_I_SIZE (&j_inode->i_ext2)) { + (int )EXT2_I_SIZE (&j_inode->i_ext2)) { retval =EXT2_ET_JOURNAL_TOO_SMALL ; goto try_backup_journal; }
e2fsck/message.c +1 -2
@@ -361,8 +361,7 @@ static _INLINE_ void expand_dirent_expression(FILE *f, ext2_filsys fs, char ch, struct problem_context *ctx) {struct ext2_dir_entry *dirent; -unsigned int rec_len; -int len; +unsigned int rec_len, len;if (!ctx || !ctx->dirent) goto no_dirent;
e2fsck/pass1.c +8 -7
@@ -1837,12 +1837,12 @@ report_problem: }/* The next extent should match this index's logical start */ if (extent.e_lblk != lblk) { -struct ext2_extent_info info; +struct ext2_extent_info e_info; -ext2fs_extent_get_info (ehandle, &info); +ext2fs_extent_get_info (ehandle, &e_info); pctx->blk = lblk; pctx->blk2 = extent.e_lblk; - pctx->num = info.curr_level -1 ; + pctx->num = e_info.curr_level -1 ; problem =PR_1_EXTENT_INDEX_START_INVALID ;if (fix_problem (ctx, problem, pctx))ext2fs_extent_fix_parents (ehandle);
@@ -1882,7 +1882,8 @@ report_problem: } pb->fragmented =1 ; } -while (is_dir && ++pb->last_db_block < extent.e_lblk) { +while (is_dir && (++pb->last_db_block < + (e2_blkcnt_t ) extent.e_lblk)) { pctx->errcode =ext2fs_add_dir_block2 (ctx->fs->dblist, pb->ino,0 , pb->last_db_block);
@@ -1904,7 +1905,7 @@ report_problem: (EXT2FS_B2C(ctx->fs, blk) == EXT2FS_B2C(ctx->fs, pb->previous_block)) && (blk & EXT2FS_CLUSTER_MASK(ctx->fs)) == - (blockcnt & EXT2FS_CLUSTER_MASK(ctx->fs)))) { + ((unsigned) blockcnt & EXT2FS_CLUSTER_MASK(ctx->fs)))) {mark_block_used (ctx, blk); pb->num_blocks++; }
@@ -2353,7 +2354,7 @@ static int process_block(ext2_filsys fs, (EXT2FS_B2C(ctx->fs, blk) == EXT2FS_B2C(ctx->fs, p->previous_block)) && (blk & EXT2FS_CLUSTER_MASK(ctx->fs)) == - (blockcnt & EXT2FS_CLUSTER_MASK(ctx->fs)))) { + ((unsigned) blockcnt & EXT2FS_CLUSTER_MASK(ctx->fs)))) {mark_block_used (ctx, blk); p->num_blocks++; }
@@ -2684,7 +2685,7 @@ static void mark_table_blocks(e2fsck_t ctx)ext2_filsys fs = ctx->fs;blk64_t b;dgrp_t i; -int j; +unsigned int j;struct problem_context pctx;clear_problem_context (&pctx);
e2fsck/pass1b.c +18 -17
@@ -624,7 +624,6 @@ static void delete_file(e2fsck_t ctx, ext2_ino_t ino, {ext2_filsys fs = ctx->fs;struct process_block_struct pb; -struct ext2_inode inode;struct problem_context pctx;unsigned int count;
@@ -635,33 +634,35 @@ static void delete_file(e2fsck_t ctx, ext2_ino_t ino, pctx.str ="delete_file" ; pb.cur_cluster = ~0 ; -e2fsck_read_inode (ctx, ino, &inode,"delete_file" ); -if (ext2fs_inode_has_valid_blocks2 (fs, &inode)) - pctx.errcode =ext2fs_block_iterate3 (fs, ino,BLOCK_FLAG_READ_ONLY , - block_buf, delete_file_block, &pb); +if (ext2fs_inode_has_valid_blocks2 (fs, &dp->inode)) + pctx.errcode =ext2fs_block_iterate3 (fs, ino, +BLOCK_FLAG_READ_ONLY , + block_buf, + delete_file_block, &pb);if (pctx.errcode)fix_problem (ctx,PR_1B_BLOCK_ITERATE , &pctx);if (ctx->inode_bad_map)ext2fs_unmark_inode_bitmap2 (ctx->inode_bad_map, ino); -ext2fs_inode_alloc_stats2 (fs, ino,-1 ,LINUX_S_ISDIR (inode.i_mode)); -quota_data_sub (ctx->qctx, &inode, ino, pb.dup_blocks * fs->blocksize); -quota_data_inodes (ctx->qctx, &inode, ino,-1 ); +ext2fs_inode_alloc_stats2 (fs, ino,-1 ,LINUX_S_ISDIR (dp->inode.i_mode)); +quota_data_sub (ctx->qctx, &dp->inode, ino, + pb.dup_blocks * fs->blocksize); +quota_data_inodes (ctx->qctx, &dp->inode, ino,-1 );/* Inode may have changed by block_iterate, so reread it */ -e2fsck_read_inode (ctx, ino, &inode,"delete_file" ); -e2fsck_clear_inode (ctx, ino, &inode,0 ,"delete_file" ); -if (ext2fs_file_acl_block (fs, &inode) && +e2fsck_read_inode (ctx, ino, &dp->inode,"delete_file" ); +e2fsck_clear_inode (ctx, ino, &dp->inode,0 ,"delete_file" ); +if (ext2fs_file_acl_block (fs, &dp->inode) && (fs->super->s_feature_compat &EXT2_FEATURE_COMPAT_EXT_ATTR )) { count =1 ; pctx.errcode =ext2fs_adjust_ea_refcount2 (fs, -ext2fs_file_acl_block (fs, &inode), +ext2fs_file_acl_block (fs, &dp->inode), block_buf,-1 , &count);if (pctx.errcode ==EXT2_ET_BAD_EA_BLOCK_NUM ) { pctx.errcode =0 ; count =1 ; }if (pctx.errcode) { - pctx.blk =ext2fs_file_acl_block (fs, &inode); + pctx.blk =ext2fs_file_acl_block (fs, &dp->inode);fix_problem (ctx,PR_1B_ADJ_EA_REFCOUNT , &pctx); }/*
@@ -672,12 +673,12 @@ static void delete_file(e2fsck_t ctx, ext2_ino_t ino,*/ if ((count ==0 ) ||ext2fs_test_block_bitmap2 (ctx->block_dup_map, -ext2fs_file_acl_block (fs, &inode))) { -blk64_t blk =ext2fs_file_acl_block (fs, &inode); +ext2fs_file_acl_block (fs, &dp->inode))) { +blk64_t blk =ext2fs_file_acl_block (fs, &dp->inode);delete_file_block (fs, &blk,BLOCK_COUNT_EXTATTR ,0 ,0 , &pb); -ext2fs_file_acl_block_set (fs, &inode, blk); -quota_data_sub (ctx->qctx, &inode, ino, fs->blocksize); +ext2fs_file_acl_block_set (fs, &dp->inode, blk); +quota_data_sub (ctx->qctx, &dp->inode, ino, fs->blocksize); } } }
e2fsck/pass2.c +1 -1
@@ -668,7 +668,7 @@ static void salvage_directory(ext2_filsys fs,*/ if ((left <0 ) && ((int ) rec_len + left >8 ) && - (name_len +8 <= (int ) rec_len + left) && + ((int ) name_len +8 <= (int ) rec_len + left) && dirent->inode <= fs->super->s_inodes_count &&strnlen (dirent->name, name_len) == name_len) { (void )ext2fs_set_rec_len (fs, (int ) rec_len + left, dirent);
e2fsck/recovery.c +10 -6
@@ -729,12 +729,16 @@ static int scan_revoke_records(journal_t *journal, struct buffer_head *bh,unsigned long long blocknr;int err; -if (record_len ==4 ) - blocknr =ext2fs_be32_to_cpu (*((__be32 *)(bh->b_data + - offset))); -else - blocknr =ext2fs_be64_to_cpu (*((__be64 *)(bh->b_data + - offset))); +if (record_len ==4 ) { +__be32 b; +memcpy (&b, bh->b_data + offset,sizeof (__be32)); + blocknr =ext2fs_be32_to_cpu (b); + }else { +__be64 b; +memcpy (&b, bh->b_data + offset,sizeof (__be64)); + blocknr =ext2fs_be64_to_cpu (b); + } + offset += record_len; err =journal_set_revoke (journal, blocknr, sequence);if (err)
e2fsck/rehash.c +4 -5
@@ -59,7 +59,7 @@ struct fill_dir_struct {e2fsck_t ctx;struct hash_entry *harray;int max_array, num_array; -int dir_size; +unsigned int dir_size;int compress;ino_t parent; };
@@ -122,7 +122,7 @@ static int fill_dir_block(ext2_filsys fs,if (((dir_offset + rec_len) > fs->blocksize) || (rec_len <8 ) || ((rec_len %4 ) !=0 ) || - (((dirent->name_len &0xFF )+8 ) > rec_len)) { + (((dirent->name_len &0xFF )+8U ) > rec_len)) { fd->err =EXT2_ET_DIR_CORRUPTED ;return BLOCK_ABORT ; }
@@ -404,10 +404,9 @@ static errcode_t copy_dir_entries(e2fsck_t ctx,char *block_start;struct hash_entry *ent;struct ext2_dir_entry *dirent; -unsigned int rec_len, prev_rec_len; -int i, left; +unsigned int rec_len, prev_rec_len, left, slack, offset; +int i;ext2_dirhash_t prev_hash; -int offset, slack;if (ctx->htree_slack_percentage ==255 ) { profile_get_uint(ctx->profile, "options",
e2fsck/sigcatcher.c +2 -1
@@ -331,7 +331,8 @@ static const char *lookup_table_fallback(int num, struct str_table *table)return buf; } -static void die_signal_handler (int signum,siginfo_t *siginfo,void *context) +static void die_signal_handler (int signum,siginfo_t *siginfo, + void *context EXT2FS_ATTR((unused))) {void *stack_syms[32 ];int frames;
e2fsck/super.c +1 -1
@@ -465,11 +465,11 @@ void check_super_block(e2fsck_t ctx)ext2_filsys fs = ctx->fs;blk64_t first_block, last_block;struct ext2_super_block *sb = fs->super; +unsigned int ipg_max;problem_t problem;blk64_t blocks_per_group = fs->super->s_blocks_per_group;__u32 bpg_max, cpg_max;int inodes_per_block; -int ipg_max;int inode_size;int accept_time_fudge;int broken_system_clock;
Signature · 1 line
1.7.12.rc0.22.gcdd159b