From: Theodore Ts'o Date: Sat, 11 Jan 2014 04:04:57 +0000 (-0500) Subject: tune2fs: add error checking to ext2fs_read_bitmaps() calls X-Git-Tag: v1.43-WIP-2015-05-18~358 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=abbf95c739cfad7990a67ce73d01f4b6626cb5fc;p=thirdparty%2Fe2fsprogs.git tune2fs: add error checking to ext2fs_read_bitmaps() calls Addresses-Coverity-Id: #1153628 Addresses-Coverity-Id: #1153629 Signed-off-by: "Theodore Ts'o" Signed-off-by: Theodore Ts'o --- diff --git a/misc/tune2fs.c b/misc/tune2fs.c index c6ec9a527..7e0c3ad3c 100644 --- a/misc/tune2fs.c +++ b/misc/tune2fs.c @@ -727,13 +727,19 @@ static void rewrite_inodes(ext2_filsys fs) static void rewrite_metadata_checksums(ext2_filsys fs) { + errcode_t retval; dgrp_t i; fs->flags |= EXT2_FLAG_IGNORE_CSUM_ERRORS; ext2fs_init_csum_seed(fs); for (i = 0; i < fs->group_desc_count; i++) ext2fs_group_desc_csum_set(fs, i); - ext2fs_read_bitmaps(fs); + retval = ext2fs_read_bitmaps(fs); + if (retval) { + com_err("rewrite_metadata_checksums", retval, + "while reading bitmaps"); + exit(1); + } rewrite_inodes(fs); ext2fs_mark_ib_dirty(fs); ext2fs_mark_bb_dirty(fs); @@ -809,7 +815,12 @@ static void disable_uninit_bg(ext2_filsys fs, __u32 csum_feature_flag) /* Load bitmaps to ensure that the uninit ones get written out */ fs->super->s_feature_ro_compat |= csum_feature_flag; - ext2fs_read_bitmaps(fs); + retval = ext2fs_read_bitmaps(fs); + if (retval) { + com_err("disable_uninit_bg", retval, + "while reading bitmaps"); + return; + } ext2fs_mark_ib_dirty(fs); ext2fs_mark_bb_dirty(fs); fs->super->s_feature_ro_compat &= ~csum_feature_flag;