From 8718d2dc3a5026c2d284575c9c60e17222be8641 Mon Sep 17 00:00:00 2001 From: Eric Sandeen Date: Oct 24 2007 02:02:21 +0000 Subject: * Tue Oct 23 2007 Eric Sandeen 1.40.2-11 - Add arm to multilib header wrapper --- diff --git a/blkid_types-wrapper.h b/blkid_types-wrapper.h index fcb60ac..25964f7 100644 --- a/blkid_types-wrapper.h +++ b/blkid_types-wrapper.h @@ -19,6 +19,8 @@ #include "blkid_types-x86_64.h" #elif defined(__alpha__) #include "blkid_types-alpha.h" +#elif defined(__arm__) +#include "blkid_types-arm.h" #else #error "This e2fsprogs-devel package does not work your architecture?" #endif diff --git a/e2fsprogs-1.39-32_bit_inodes.patch b/e2fsprogs-1.39-32_bit_inodes.patch deleted file mode 100644 index f6ed713..0000000 --- a/e2fsprogs-1.39-32_bit_inodes.patch +++ /dev/null @@ -1,168 +0,0 @@ -# HG changeset patch -# User tytso@mit.edu -# Date Tue Sep 12 14:56:17 2006 -0400 -# Node ID 7e1e8751d2be27716166e88453b52273b7096039 -# parent: 1aa8aca8acebca38b38ee003c17a045bc5fde185 -Add checks to make sure inode counts don't overflow a 32-bit value - -Signed-off-by: Eric Sandeen - -Index: e2fsprogs-1.39-my-patches-from-ted/e2fsck/ChangeLog -=================================================================== ---- e2fsprogs-1.39-my-patches-from-ted.orig/e2fsck/ChangeLog -+++ e2fsprogs-1.39-my-patches-from-ted/e2fsck/ChangeLog -@@ -6,6 +6,10 @@ - - 2006-08-30 Eric Sandeen - -+ * unix.c (show_stats): use ext2_ino_t for inode containers. -+ -+2006-08-30 Eric Sandeen -+ - * e2fsck.h (e2fsck): Use unsigned types for filesystem counters. - * emptydir.c (add_empty_dirblock): - * iscan.c (main): -Index: e2fsprogs-1.39-my-patches-from-ted/e2fsck/unix.c -=================================================================== ---- e2fsprogs-1.39-my-patches-from-ted.orig/e2fsck/unix.c -+++ e2fsprogs-1.39-my-patches-from-ted/e2fsck/unix.c -@@ -98,7 +98,7 @@ static void usage(e2fsck_t ctx) - static void show_stats(e2fsck_t ctx) - { - ext2_filsys fs = ctx->fs; -- __u32 inodes, inodes_used; -+ ext2_ino_t inodes, inodes_used; - blk_t blocks, blocks_used; - int dir_links; - int num_files, num_links; -Index: e2fsprogs-1.39-my-patches-from-ted/lib/ext2fs/ChangeLog -=================================================================== ---- e2fsprogs-1.39-my-patches-from-ted.orig/lib/ext2fs/ChangeLog -+++ e2fsprogs-1.39-my-patches-from-ted/lib/ext2fs/ChangeLog -@@ -8,6 +8,11 @@ - - 2006-08-30 Eric Sandeen - -+ * initialize.c (ext2fs_initialize): Make sure inode count does -+ not overflow 32 bits. -+ -+2006-08-30 Eric Sandeen -+ - * bmove.c (process_block): - * getsize.c (main): - * icount.c (ext2fs_create_icount2, insert_icount_el): -Index: e2fsprogs-1.39-my-patches-from-ted/lib/ext2fs/initialize.c -=================================================================== ---- e2fsprogs-1.39-my-patches-from-ted.orig/lib/ext2fs/initialize.c -+++ e2fsprogs-1.39-my-patches-from-ted/lib/ext2fs/initialize.c -@@ -246,9 +246,8 @@ retry: - if (ipg > (unsigned) EXT2_MAX_INODES_PER_GROUP(super)) - ipg = EXT2_MAX_INODES_PER_GROUP(super); - -+ipg_retry: - super->s_inodes_per_group = ipg; -- if (super->s_inodes_count > ipg * fs->group_desc_count) -- super->s_inodes_count = ipg * fs->group_desc_count; - - /* - * Make sure the number of inodes per group completely fills -@@ -276,6 +275,10 @@ retry: - /* - * adjust inode count to reflect the adjusted inodes_per_group - */ -+ if ((__u64)super->s_inodes_per_group * fs->group_desc_count > ~0U) { -+ ipg--; -+ goto ipg_retry; -+ } - super->s_inodes_count = super->s_inodes_per_group * - fs->group_desc_count; - super->s_free_inodes_count = super->s_inodes_count; -Index: e2fsprogs-1.39-my-patches-from-ted/misc/ChangeLog -=================================================================== ---- e2fsprogs-1.39-my-patches-from-ted.orig/misc/ChangeLog -+++ e2fsprogs-1.39-my-patches-from-ted/misc/ChangeLog -@@ -5,6 +5,10 @@ - - 2006-08-30 Eric Sandeen - -+ * mke2fs.c (PRS): Disallow > 2^32 inodes at mkfs time. -+ -+2006-08-30 Eric Sandeen -+ - * dumpe2fs.c (list_bad_blocks): - * e2image.c (output_meta_data_blocks, write_raw_image_file): - * mke2fs.c (test_disk, handle_bad_blocks): Fix printf formats. -Index: e2fsprogs-1.39-my-patches-from-ted/misc/mke2fs.c -=================================================================== ---- e2fsprogs-1.39-my-patches-from-ted.orig/misc/mke2fs.c -+++ e2fsprogs-1.39-my-patches-from-ted/misc/mke2fs.c -@@ -895,7 +895,7 @@ static void PRS(int argc, char *argv[]) - double reserved_ratio = 5.0; - int sector_size = 0; - int show_version_only = 0; -- ext2_ino_t num_inodes = 0; -+ __u64 num_inodes = 0; /* u64 to catch too-large input */ - errcode_t retval; - char * oldpath = getenv("PATH"); - char * extended_opts = 0; -@@ -1430,6 +1430,21 @@ static void PRS(int argc, char *argv[]) - fs_param.s_inode_size = inode_size; - } - -+ /* Make sure number of inodes specified will fit in 32 bits */ -+ if (num_inodes == 0) { -+ __u64 n; -+ n = (__u64) fs_param.s_blocks_count * blocksize / inode_ratio; -+ if (n > ~0U) { -+ com_err(program_name, 0, -+ _("too many inodes (%llu), raise inode ratio?"), n); -+ exit(1); -+ } -+ } else if (num_inodes > ~0U) { -+ com_err(program_name, 0, -+ _("too many inodes (%llu), specify < 2^32 inodes"), -+ (__u64)num_inodes); -+ exit(1); -+ } - /* - * Calculate number of inodes based on the inode ratio - */ -Index: e2fsprogs-1.39-my-patches-from-ted/resize/ChangeLog -=================================================================== ---- e2fsprogs-1.39-my-patches-from-ted.orig/resize/ChangeLog -+++ e2fsprogs-1.39-my-patches-from-ted/resize/ChangeLog -@@ -1,5 +1,9 @@ - 2006-08-30 Eric Sandeen - -+ * resize2fs.c (adjust_fs_info): Disallow > 2^32 indoes at resize time. -+ -+2006-08-30 Eric Sandeen -+ - * online.c (online_resize_fs): Fix printf formats. - - 2006-08-30 Eric Sandeen -Index: e2fsprogs-1.39-my-patches-from-ted/resize/resize2fs.c -=================================================================== ---- e2fsprogs-1.39-my-patches-from-ted.orig/resize/resize2fs.c -+++ e2fsprogs-1.39-my-patches-from-ted/resize/resize2fs.c -@@ -186,6 +186,7 @@ errcode_t adjust_fs_info(ext2_filsys fs, - unsigned long i, j, old_desc_blocks, max_group; - unsigned int meta_bg, meta_bg_size; - int has_super; -+ __u64 new_inodes; /* u64 to check for overflow */ - - fs->super->s_blocks_count = new_size; - -@@ -226,6 +227,12 @@ retry: - /* - * Adjust the number of inodes - */ -+ new_inodes =(__u64)fs->super->s_inodes_per_group * fs->group_desc_count; -+ if (new_inodes > ~0U) { -+ fprintf(stderr, _("inodes (%llu) must be less than %u"), -+ new_inodes, ~0U); -+ return EXT2_ET_TOO_MANY_INODES; -+ } - fs->super->s_inodes_count = fs->super->s_inodes_per_group * - fs->group_desc_count; - diff --git a/e2fsprogs-1.39-LUKS-blkid.patch b/e2fsprogs-1.39-LUKS-blkid.patch deleted file mode 100644 index 53299fb..0000000 --- a/e2fsprogs-1.39-LUKS-blkid.patch +++ /dev/null @@ -1,87 +0,0 @@ -Theodore Tso schrieb: -> > On Mon, Jun 11, 2007 at 01:51:24PM +0200, Karsten Hopp wrote: ->> >> +static int probe_luks(struct blkid_probe *probe, ->> >> + struct blkid_magic *id __BLKID_ATTR((unused)), ->> >> + unsigned char *buf) ->> >> +{ ->> >> + unsigned char *p_buf = buf; ->> >> + unsigned char uuid[40]; ->> >> + /* 168 is the offset to the 40 character uuid: ->> >> + * http://luks.endorphin.org/LUKS-on-disk-format.pdf */ ->> >> + p_buf += 168; ->> >> + strncpy(uuid, p_buf, 40); -> > -> > Why bother with p_buf? It would actually be shorter and sweeter to -> > do: -> > -> > strncpy(uuid, buf+168, 40); -> > -> > And remove the lines dealing with p_buf above. -> > ->> >> + { "crypt_LUKS",0, 0, 6, "LUKS\xba\xbe", probe_luks }, -> > -> > Any particular reason to use "crypt_LUKS" instead of just "LUKS"? In -> > your documentation you generally just refer to it as LUKS. -> > -> > - Ted - -I've used 'luks' in my first patch, but changed it to 'crypt_LUKS' when -Karel Zak pointed out that libvolume_id from udev already uses 'crypt_LUKS' -for this. -My first patch also did some other (unnecessary) stuff with p_buf and I just -didn't bother to remove it. -I'll attach a new patch without p_buf. - - Karsten - --- - Karsten Hopp | Mail: karsten@redhat.de - Red Hat Deutschland | Tel: +49-711-96437-0 - Hauptstaetterstr.58 | Fax: +49-711-613590 - D-70178 Stuttgart | http://www.redhat.de - - - -e2fsprogs-1.39-luks.patch -Problem: libblkid doesn't detect/report UUIDs of cryptsetup-luks partitio -ns -Solution: Add probe for luks UUID -Signed-off-by: Karsten Hopp - ---- e2fsprogs-1.39/lib/blkid/ChangeLog.luksuuid 2007-06-11 13:40:14.000000000 +0200 -+++ e2fsprogs-1.39/lib/blkid/ChangeLog 2007-06-11 13:40:14.000000000 +0200 -@@ -0,0 +1,4 @@ -+2007-05-22 Karsten Hopp -+ -+ * probe.c (probe_luks): Add support for cryptsetup-luks partitions -+ ---- e2fsprogs-1.39/lib/blkid/probe.c.luksuuid 2007-06-11 13:40:14.000000000 +0200 -+++ e2fsprogs-1.39/lib/blkid/probe.c 2007-06-13 12:50:27.000000000 +0200 -@@ -468,6 +468,18 @@ static int probe_jfs(struct blkid_probe - return 0; - } - -+static int probe_luks(struct blkid_probe *probe, -+ struct blkid_magic *id __BLKID_ATTR((unused)), -+ unsigned char *buf) -+{ -+ unsigned char uuid[40]; -+ /* 168 is the offset to the 40 character uuid: -+ * http://luks.endorphin.org/LUKS-on-disk-format.pdf */ -+ strncpy(uuid, buf+168, 40); -+ blkid_set_tag(probe->dev, "UUID", uuid, sizeof(uuid)); -+ return 0; -+} -+ - static int probe_romfs(struct blkid_probe *probe, - struct blkid_magic *id __BLKID_ATTR((unused)), - unsigned char *buf) -@@ -775,6 +787,7 @@ static struct blkid_magic type_array[] = - { "ocfs2", 2, 0, 6, "OCFSV2", probe_ocfs2 }, - { "ocfs2", 4, 0, 6, "OCFSV2", probe_ocfs2 }, - { "ocfs2", 8, 0, 6, "OCFSV2", probe_ocfs2 }, -+ { "crypt_LUKS",0, 0, 6, "LUKS\xba\xbe", probe_luks }, - { NULL, 0, 0, 0, NULL, NULL } - }; - - diff --git a/e2fsprogs-1.39-blkid-devname.patch b/e2fsprogs-1.39-blkid-devname.patch deleted file mode 100644 index c8c4985..0000000 --- a/e2fsprogs-1.39-blkid-devname.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- e2fsprogs-1.39/lib/blkid/devname.c.foo 2006-07-20 16:48:07.000000000 -0400 -+++ e2fsprogs-1.39/lib/blkid/devname.c 2006-07-20 16:48:18.000000000 -0400 -@@ -291,7 +291,7 @@ - - names = (void *)names + next; - -- rc = asprintf(&device, "/dev/mapper/%s", names->name); -+ rc = asprintf(&device, "mapper/%s", names->name); - if (rc < 0) - goto try_next; - diff --git a/e2fsprogs-1.39-blkid-fatlabel.patch b/e2fsprogs-1.39-blkid-fatlabel.patch deleted file mode 100644 index 57d4bb0..0000000 --- a/e2fsprogs-1.39-blkid-fatlabel.patch +++ /dev/null @@ -1,20 +0,0 @@ ---- e2fsprogs-1.39/lib/blkid/probe.c.fatlabel 2006-09-17 15:45:54.000000000 +0200 -+++ e2fsprogs-1.39/lib/blkid/probe.c 2006-09-17 15:46:32.000000000 +0200 -@@ -348,8 +348,8 @@ - } - - if (vol_label && memcmp(vol_label, no_name, 11)) { -- label = vol_label; -- label_len = figure_label_len(vol_label, 11); -+ if ((label_len = figure_label_len(vol_label, 11))) -+ label = vol_label; - } - - /* We can't just print them as %04X, because they are unaligned */ ---- e2fsprogs-1.39/lib/blkid/ChangeLog.fatlabel 2006-09-17 15:51:05.000000000 +0200 -+++ e2fsprogs-1.39/lib/blkid/ChangeLog 2006-09-17 15:52:37.000000000 +0200 -@@ -0,0 +1,4 @@ -+2006-09-17 Karel Zak -+ -+ * probe.c (probe_fat): Fix problem with empty FAT label. -+ diff --git a/e2fsprogs-1.39-blkid-gfs.patch b/e2fsprogs-1.39-blkid-gfs.patch deleted file mode 100644 index bb70ccf..0000000 --- a/e2fsprogs-1.39-blkid-gfs.patch +++ /dev/null @@ -1,126 +0,0 @@ ---- e2fsprogs-1.39/lib/blkid/probe.c.gfs 2006-05-14 23:24:09.000000000 +0200 -+++ e2fsprogs-1.39/lib/blkid/probe.c 2006-07-10 08:15:11.000000000 +0200 -@@ -646,6 +646,50 @@ - return 0; - } - -+static int probe_gfs(struct blkid_probe *probe, -+ struct blkid_magic *id __BLKID_ATTR((unused)), -+ unsigned char *buf) -+{ -+ struct gfs2_sb *sbd; -+ const char *label = 0; -+ -+ sbd = (struct gfs2_sb *)buf; -+ -+ if (blkid_be32(sbd->sb_fs_format) == GFS_FORMAT_FS && -+ blkid_be32(sbd->sb_multihost_format) == GFS_FORMAT_MULTI) -+ { -+ blkid_set_tag(probe->dev, "UUID", 0, 0); -+ -+ if (strlen(sbd->sb_locktable)) -+ label = sbd->sb_locktable; -+ blkid_set_tag(probe->dev, "LABEL", label, sizeof(sbd->sb_locktable)); -+ return 0; -+ } -+ return 1; -+} -+ -+static int probe_gfs2(struct blkid_probe *probe, -+ struct blkid_magic *id __BLKID_ATTR((unused)), -+ unsigned char *buf) -+{ -+ struct gfs2_sb *sbd; -+ const char *label = 0; -+ -+ sbd = (struct gfs2_sb *)buf; -+ -+ if (blkid_be32(sbd->sb_fs_format) == GFS2_FORMAT_FS && -+ blkid_be32(sbd->sb_multihost_format) == GFS2_FORMAT_MULTI) -+ { -+ blkid_set_tag(probe->dev, "UUID", 0, 0); -+ -+ if (strlen(sbd->sb_locktable)) -+ label = sbd->sb_locktable; -+ blkid_set_tag(probe->dev, "LABEL", label, sizeof(sbd->sb_locktable)); -+ return 0; -+ } -+ return 1; -+} -+ - /* - * BLKID_BLK_OFFS is at least as large as the highest bim_kboff defined - * in the type_array table below + bim_kbalign. -@@ -673,6 +717,8 @@ - { "reiserfs", 64, 0x34, 8, "ReIsErFs", probe_reiserfs }, - { "reiserfs", 8, 20, 8, "ReIsErFs", probe_reiserfs }, - { "reiser4", 64, 0, 7, "ReIsEr4", probe_reiserfs4 }, -+ { "gfs2", 64, 0, 4, "\x01\x16\x19\x70", probe_gfs2 }, -+ { "gfs", 64, 0, 4, "\x01\x16\x19\x70", probe_gfs }, - { "vfat", 0, 0x52, 5, "MSWIN", probe_fat }, - { "vfat", 0, 0x52, 8, "FAT32 ", probe_fat }, - { "vfat", 0, 0x36, 5, "MSDOS", probe_fat }, ---- e2fsprogs-1.39/lib/blkid/probe.h.gfs 2006-03-10 21:43:35.000000000 +0100 -+++ e2fsprogs-1.39/lib/blkid/probe.h 2006-07-07 13:45:43.000000000 +0200 -@@ -345,6 +345,54 @@ - unsigned char escape_sequences[8]; - }; - -+/* Common gfs/gfs2 constants: */ -+#define GFS_MAGIC 0x01161970 -+#define GFS_DEFAULT_BSIZE 4096 -+#define GFS_SUPERBLOCK_OFFSET (0x10 * GFS_DEFAULT_BSIZE) -+#define GFS_METATYPE_SB 1 -+#define GFS_FORMAT_SB 100 -+#define GFS_LOCKNAME_LEN 64 -+ -+/* gfs1 constants: */ -+#define GFS_FORMAT_FS 1309 -+#define GFS_FORMAT_MULTI 1401 -+/* gfs2 constants: */ -+#define GFS2_FORMAT_FS 1801 -+#define GFS2_FORMAT_MULTI 1900 -+ -+struct gfs2_meta_header { -+ __u32 mh_magic; -+ __u32 mh_type; -+ __u64 __pad0; /* Was generation number in gfs1 */ -+ __u32 mh_format; -+ __u32 __pad1; /* Was incarnation number in gfs1 */ -+}; -+ -+struct gfs2_inum { -+ __u64 no_formal_ino; -+ __u64 no_addr; -+}; -+ -+struct gfs2_sb { -+ struct gfs2_meta_header sb_header; -+ -+ __u32 sb_fs_format; -+ __u32 sb_multihost_format; -+ __u32 __pad0; /* Was superblock flags in gfs1 */ -+ -+ __u32 sb_bsize; -+ __u32 sb_bsize_shift; -+ __u32 __pad1; /* Was journal segment size in gfs1 */ -+ -+ struct gfs2_inum sb_master_dir; /* Was jindex dinode in gfs1 */ -+ struct gfs2_inum __pad2; /* Was rindex dinode in gfs1 */ -+ struct gfs2_inum sb_root_dir; -+ -+ char sb_lockproto[GFS_LOCKNAME_LEN]; -+ char sb_locktable[GFS_LOCKNAME_LEN]; -+ /* In gfs1, quota and license dinodes followed */ -+} PACKED; -+ - /* - * Byte swap functions - */ ---- e2fsprogs-1.39/lib/blkid/ChangeLog.gfs 2006-05-14 23:25:12.000000000 +0200 -+++ e2fsprogs-1.39/lib/blkid/ChangeLog 2006-07-10 08:16:22.000000000 +0200 -@@ -0,0 +1,4 @@ -+2006-07-10 Karel Zak -+ -+ * probe.c (probe_gfs, _gfs2), probe.h: Add support for GFS/GFS2 -+ diff --git a/e2fsprogs-1.39-close-on-error.patch b/e2fsprogs-1.39-close-on-error.patch deleted file mode 100644 index 33d2a06..0000000 --- a/e2fsprogs-1.39-close-on-error.patch +++ /dev/null @@ -1,28 +0,0 @@ ---- e2fsprogs-1.39/lib/ext2fs/getsize.c.close-on-error 2005-09-06 11:40:14.000000000 +0200 -+++ e2fsprogs-1.39/lib/ext2fs/getsize.c 2006-06-22 14:46:27.000000000 +0200 -@@ -169,8 +169,10 @@ - #ifdef DKIOCGETBLOCKCOUNT /* For Apple Darwin */ - if (ioctl(fd, DKIOCGETBLOCKCOUNT, &size64) >= 0) { - if ((sizeof(*retblocks) < sizeof(unsigned long long)) -- && ((size64 / (blocksize / 512)) > 0xFFFFFFFF)) -- return EFBIG; -+ && ((size64 / (blocksize / 512)) > 0xFFFFFFFF)) { -+ rc = EFBIG; -+ goto out; -+ } - *retblocks = size64 / (blocksize / 512); - goto out; - } -@@ -275,8 +277,10 @@ - valid_offset (fd, 0); - size64 = low + 1; - if ((sizeof(*retblocks) < sizeof(unsigned long long)) -- && ((size64 / blocksize) > 0xFFFFFFFF)) -- return EFBIG; -+ && ((size64 / blocksize) > 0xFFFFFFFF)) { -+ rc = EFBIG; -+ goto out; -+ } - *retblocks = size64 / blocksize; - out: - close(fd); diff --git a/e2fsprogs-1.39-coverity.patch b/e2fsprogs-1.39-coverity.patch deleted file mode 100644 index d56e79a..0000000 --- a/e2fsprogs-1.39-coverity.patch +++ /dev/null @@ -1,1995 +0,0 @@ - -# HG changeset patch -# User tytso@mit.edu -# Date 1174230993 14400 -# Node ID 6727a63dca01a234bf336c791ea872d964bdb19d -# Parent 5d5a64d315ac91d34ee02a415fde544093ba477b -[COVERITY] Fix missing return code check for ext2fs_write_inode - -Found 2 of the three places where a return code for ext2fs_write_inode() was -not being checked. - -The second fix in e2fsck/emptydir.c is basically just to shut coverity up even -though it really is unnecessary. - -Coverity ID: 1: Checked Return - -Signed-off-by: Brian Behlendorf -Signed-off-by: "Theodore Ts'o" - -Index: e2fsprogs-1.39-RHEL5/e2fsck/emptydir.c -=================================================================== ---- e2fsprogs-1.39-RHEL5.orig/e2fsck/emptydir.c -+++ e2fsprogs-1.39-RHEL5/e2fsck/emptydir.c -@@ -170,7 +170,9 @@ static int fix_directory(ext2_filsys fs, - edi->inode.i_size -= edi->freed_blocks * fs->blocksize; - edi->inode.i_blocks -= edi->freed_blocks * - (fs->blocksize / 512); -- (void) ext2fs_write_inode(fs, db->ino, &edi->inode); -+ retval = ext2fs_write_inode(fs, db->ino, &edi->inode); -+ if (retval) -+ return 0; - } - return 0; - } -Index: e2fsprogs-1.39-RHEL5/resize/ChangeLog -=================================================================== ---- e2fsprogs-1.39-RHEL5.orig/resize/ChangeLog -+++ e2fsprogs-1.39-RHEL5/resize/ChangeLog -@@ -1,3 +1,8 @@ -+2007-03-18 Theodore Tso -+ -+ * resize2fs.c (check_and_change_inodes): Check to make sure the -+ inode write was sucessful. -+ - 2006-08-30 Eric Sandeen - - * online.c (online_resize_fs): use div_ceil for r_frac calculation. -Index: e2fsprogs-1.39-RHEL5/resize/resize2fs.c -=================================================================== ---- e2fsprogs-1.39-RHEL5.orig/resize/resize2fs.c -+++ e2fsprogs-1.39-RHEL5/resize/resize2fs.c -@@ -1306,7 +1306,9 @@ static int check_and_change_inodes(ext2_ - retval = ext2fs_read_inode(is->rfs->old_fs, dir, &inode); - if (retval == 0) { - inode.i_mtime = inode.i_ctime = time(0); -- ext2fs_write_inode(is->rfs->old_fs, dir, &inode); -+ is->err = ext2fs_write_inode(is->rfs->old_fs, dir, &inode); -+ if (is->err) -+ return DIRENT_ABORT; - } - - return DIRENT_CHANGED; - -# HG changeset patch -# User tytso@mit.edu -# Date 1174307805 14400 -# Node ID f2b55541174de6277f11618cfdc3745b6833fbc4 -# Parent 5b4e3e808f5e3ae78a9bb5bcd85696dfa2312192 -[COVERITY] Fix segfault bug if the profile directory is empty - -Coverity ID: 5: Forward NULL - -Signed-off-by: Brian Behlendorf -Signed-off-by: "Theodore Ts'o" - -Index: e2fsprogs-1.39-RHEL5/e2fsck/ChangeLog -=================================================================== ---- e2fsprogs-1.39-RHEL5.orig/e2fsck/ChangeLog -+++ e2fsprogs-1.39-RHEL5/e2fsck/ChangeLog -@@ -1,3 +1,9 @@ -+2007-03-19 Theodore Tso -+ -+ * profile.c (profile_init, get_dirlist): Fix bug where if a -+ profile directory is completely empty, the profile library -+ would segfault. -+ - 2006-08-30 Eric Sandeen - - * pass1.c (handle_bad_fs_blocks): use blk_t, not int for first_block. -Index: e2fsprogs-1.39-RHEL5/e2fsck/profile.c -=================================================================== ---- e2fsprogs-1.39-RHEL5.orig/e2fsck/profile.c -+++ e2fsprogs-1.39-RHEL5/e2fsck/profile.c -@@ -279,8 +279,10 @@ static errcode_t get_dirlist(const char - } - array[num++] = fn; - } -- qsort(array, num, sizeof(char *), compstr); -- array[num++] = 0; -+ if (array) { -+ qsort(array, num, sizeof(char *), compstr); -+ array[num++] = 0; -+ } - *ret_array = array; - closedir(dir); - return 0; -@@ -311,6 +313,8 @@ profile_init(const char **files, profile - for (fs = files; !PROFILE_LAST_FILESPEC(*fs); fs++) { - retval = get_dirlist(*fs, &array); - if (retval == 0) { -+ if (!array) -+ continue; - for (cpp = array; (cp = *cpp); cpp++) { - retval = profile_open_file(cp, &new_file); - if (retval == EACCES) - -# HG changeset patch -# User tytso@mit.edu -# Date 1174307972 14400 -# Node ID 1243b7a37f2cefef64c65f467791c2295f907104 -# Parent f2b55541174de6277f11618cfdc3745b6833fbc4 -[COVERITY] Fix bad error checking for NULL parameter in ss library - -Looks like flawed reasoning. Here if info_dir is NULL then you are -guaranteed to blow up since you will dereference it. It seems like the -correct thing to do here (what the code author meant to do) was to set -*code_ptr = SS_ET_NO_INFO_DIR if info_dir was NULL or if *info_dir was -an empty string (aka *info_dir == '\0'). - -Coverity ID: 8: Forward Null - -Signed-off-by: Brian Behlendorf - -Index: e2fsprogs-1.39-RHEL5/lib/ss/ChangeLog -=================================================================== ---- e2fsprogs-1.39-RHEL5.orig/lib/ss/ChangeLog -+++ e2fsprogs-1.39-RHEL5/lib/ss/ChangeLog -@@ -1,3 +1,8 @@ -+2007-03-19 Theodore Tso -+ -+ * help.c (ss_add_info_dir): Fix error checking for NULL parameter -+ passed via info_dir. -+ - 2005-12-10 Theodore Ts'o - - * Makefile.in: Add a dependency to make sure that the -Index: e2fsprogs-1.39-RHEL5/lib/ss/help.c -=================================================================== ---- e2fsprogs-1.39-RHEL5.orig/lib/ss/help.c -+++ e2fsprogs-1.39-RHEL5/lib/ss/help.c -@@ -138,7 +138,7 @@ void ss_add_info_dir(sci_idx, info_dir, - register char **dirs; - - info = ss_info(sci_idx); -- if (info_dir == NULL && *info_dir) { -+ if (info_dir == NULL || *info_dir == '\0') { - *code_ptr = SS_ET_NO_INFO_DIR; - return; - } - -# HG changeset patch -# User tytso@mit.edu -# Date 1174308730 14400 -# Node ID 69479f9c2f1ca73b8dcd9fca8692cb165b046995 -# Parent 1243b7a37f2cefef64c65f467791c2295f907104 -[COVERITY] Check for NULL return from dict_lookup() in e2fsck - -The dict_lookup() function can potentially return a NULL dnode_t. It is -not checked in two places in the clone_file() function. Looks to be -safe to continue if n is NULL, so just print a warning message and -continue. - -Coverity ID: 9: Null Returns - -Signed-off-by: Brian Behlendorf -Signed-off-by: "Theodore Ts'o" - -Index: e2fsprogs-1.39-RHEL5/e2fsck/ChangeLog -=================================================================== ---- e2fsprogs-1.39-RHEL5.orig/e2fsck/ChangeLog -+++ e2fsprogs-1.39-RHEL5/e2fsck/ChangeLog -@@ -1,5 +1,9 @@ - 2007-03-19 Theodore Tso - -+ * pass1b.c (clone_file): Fix a coverity-found bug; add error -+ checking in case dict_lookup() returns NULL when looking up -+ an block or inode record after cloning the EA block. -+ - * profile.c (profile_init, get_dirlist): Fix bug where if a - profile directory is completely empty, the profile library - would segfault. -Index: e2fsprogs-1.39-RHEL5/e2fsck/pass1b.c -=================================================================== ---- e2fsprogs-1.39-RHEL5.orig/e2fsck/pass1b.c -+++ e2fsprogs-1.39-RHEL5/e2fsck/pass1b.c -@@ -752,11 +752,26 @@ static int clone_file(e2fsck_t ctx, ext2 - * them to point to the new EA block. - */ - n = dict_lookup(&blk_dict, INT_TO_VOIDPTR(blk)); -+ if (!n) { -+ com_err("clone_file", 0, -+ _("internal error: couldn't lookup EA " -+ "block record for %u"), blk); -+ retval = 0; /* OK to stumble on... */ -+ goto errout; -+ } - db = (struct dup_block *) dnode_get(n); - for (ino_el = db->inode_list; ino_el; ino_el = ino_el->next) { - if (ino_el->inode == ino) - continue; - n = dict_lookup(&ino_dict, INT_TO_VOIDPTR(ino_el->inode)); -+ if (!n) { -+ com_err("clone_file", 0, -+ _("internal error: couldn't lookup EA " -+ "inode record for %u"), -+ ino_el->inode); -+ retval = 0; /* OK to stumble on... */ -+ goto errout; -+ } - di = (struct dup_inode *) dnode_get(n); - if (di->inode.i_file_acl == blk) { - di->inode.i_file_acl = dp->inode.i_file_acl; - -# HG changeset patch -# User tytso@mit.edu -# Date 1174309127 14400 -# Node ID dcaef25d7a5550b034898123e995444b8d49bcae -# Parent 69479f9c2f1ca73b8dcd9fca8692cb165b046995 -[COVERITY] Add missing NULL check to e2fsck_get_dir_info() - -It is possible that e2fsck_get_dir_info() returns a NULL pointer. -We do not want to blow up when dereferencing p. It seems to be -more sane/safe to call fix_problem(ctx, PR_3_NO_DIRINFO, pctx) -if p is NULL at this point since we do not have any DIRINFO -for pctx->ino. - -Also fix another (already existing) error check for -e2fsck_get_dir_info() later in the function so that it reports the -correct inode number if the dirinfo information is not found for -p->parent. - -(Both of these are "should-never-happen" internal e2fsck errors that -would indicate a programming bug of some kind.) - -Coverity ID: 10: Null Returns - -Signed-off-by: Brian Behlendorf -Signed-off-by: "Theodore Ts'o" - -Index: e2fsprogs-1.39-RHEL5/e2fsck/ChangeLog -=================================================================== ---- e2fsprogs-1.39-RHEL5.orig/e2fsck/ChangeLog -+++ e2fsprogs-1.39-RHEL5/e2fsck/ChangeLog -@@ -1,5 +1,11 @@ - 2007-03-19 Theodore Tso - -+ * pass3.c (check_directory): Add error check in case -+ e2fsck_get_dir_info() returns NULL. Also fix another -+ error check for e2fsck_get_dir_info() to display the -+ correct inode number in case of this internal (should -+ never happen) error. -+ - * pass1b.c (clone_file): Fix a coverity-found bug; add error - checking in case dict_lookup() returns NULL when looking up - an block or inode record after cloning the EA block. -Index: e2fsprogs-1.39-RHEL5/e2fsck/pass3.c -=================================================================== ---- e2fsprogs-1.39-RHEL5.orig/e2fsck/pass3.c -+++ e2fsprogs-1.39-RHEL5/e2fsck/pass3.c -@@ -306,6 +306,11 @@ static int check_directory(e2fsck_t ctx, - ext2fs_unmark_valid(fs); - else { - p = e2fsck_get_dir_info(ctx, pctx->ino); -+ if (!p) { -+ fix_problem(ctx, -+ PR_3_NO_DIRINFO, pctx); -+ return 0; -+ } - p->parent = ctx->lost_and_found; - fix_dotdot(ctx, p, ctx->lost_and_found); - } -@@ -314,6 +319,7 @@ static int check_directory(e2fsck_t ctx, - } - p = e2fsck_get_dir_info(ctx, p->parent); - if (!p) { -+ pctx->ino = p->parent; - fix_problem(ctx, PR_3_NO_DIRINFO, pctx); - return 0; - } - -# HG changeset patch -# User tytso@mit.edu -# Date 1174504155 14400 -# Node ID 4c321a4ecbd6d56b4bbbb2dfb2527bf886c4ad57 -# Parent dcaef25d7a5550b034898123e995444b8d49bcae -[COVERITY] Avoid static buffer overruns in debugfs - -Add an extra byte to EXT2_NAME_LEN in the static allocation for the -required trailing null. This allows filenames up to the maximum -length of EXT2_NAME_LEN withover an overrun. - -Coverity ID: 11: Overrun Static -Coverity ID: 12: Overrun Static -Coverity ID: 13: Overrun Static - -Signed-off-by: Brian Behlendorf -Signed-off-by: "Theodore Ts'o" - -Index: e2fsprogs-1.39-RHEL5/debugfs/ChangeLog -=================================================================== ---- e2fsprogs-1.39-RHEL5.orig/debugfs/ChangeLog -+++ e2fsprogs-1.39-RHEL5/debugfs/ChangeLog -@@ -1,3 +1,10 @@ -+2007-03-21 Theodore Tso -+ -+ * dump.c (rdump_dirent), htree.c (htree_dump_leaf_node), -+ ls.c (list_dir_proc): Add an extra byte to EXT2_NAME_LEN -+ to avoid the possibility of an array overrun if the -+ filename is exactly EXT2_NAME_LEN in size. -+ - 2006-08-30 Eric Sandeen - - * htree.c (htree_dump_int_node): Fix printf formats. -Index: e2fsprogs-1.39-RHEL5/debugfs/dump.c -=================================================================== ---- e2fsprogs-1.39-RHEL5.orig/debugfs/dump.c -+++ e2fsprogs-1.39-RHEL5/debugfs/dump.c -@@ -292,7 +292,7 @@ static int rdump_dirent(struct ext2_dir_ - int blocksize EXT2FS_ATTR((unused)), - char *buf EXT2FS_ATTR((unused)), void *private) - { -- char name[EXT2_NAME_LEN]; -+ char name[EXT2_NAME_LEN + 1]; - int thislen; - const char *dumproot = private; - struct ext2_inode inode; -Index: e2fsprogs-1.39-RHEL5/debugfs/htree.c -=================================================================== ---- e2fsprogs-1.39-RHEL5.orig/debugfs/htree.c -+++ e2fsprogs-1.39-RHEL5/debugfs/htree.c -@@ -35,7 +35,7 @@ static void htree_dump_leaf_node(ext2_fi - struct ext2_dir_entry *dirent; - int thislen, col = 0; - unsigned int offset = 0; -- char name[EXT2_NAME_LEN]; -+ char name[EXT2_NAME_LEN + 1]; - char tmp[EXT2_NAME_LEN + 16]; - blk_t pblk; - ext2_dirhash_t hash; -Index: e2fsprogs-1.39-RHEL5/debugfs/ls.c -=================================================================== ---- e2fsprogs-1.39-RHEL5.orig/debugfs/ls.c -+++ e2fsprogs-1.39-RHEL5/debugfs/ls.c -@@ -52,7 +52,7 @@ static int list_dir_proc(ext2_ino_t dir - ext2_ino_t ino; - struct tm *tm_p; - time_t modtime; -- char name[EXT2_NAME_LEN]; -+ char name[EXT2_NAME_LEN + 1]; - char tmp[EXT2_NAME_LEN + 16]; - char datestr[80]; - char lbr, rbr; - -# HG changeset patch -# User tytso@mit.edu -# Date 1174508077 14400 -# Node ID 54ccaea56d803d9e08740e3a739585aabc802738 -# Parent 4c321a4ecbd6d56b4bbbb2dfb2527bf886c4ad57 -[COVERITY] Fix memory leak in profile library - -The profile must be freed early if the subsequent memory allocation -fails for 'expanded_filename'. - -Coverity ID: 14: Resource Leak - -Signed-off-by: Brian Behlendorf -Signed-off-by: "Theodore Ts'o" - -Index: e2fsprogs-1.39-RHEL5/e2fsck/ChangeLog -=================================================================== ---- e2fsprogs-1.39-RHEL5.orig/e2fsck/ChangeLog -+++ e2fsprogs-1.39-RHEL5/e2fsck/ChangeLog -@@ -1,3 +1,8 @@ -+2007-03-21 Theodore Tso -+ -+ * profile.c (profile_open_file): Fix memory leak if malloc() fails -+ while setting up the profile data structure. -+ - 2007-03-19 Theodore Tso - - * pass3.c (check_directory): Add error check in case -Index: e2fsprogs-1.39-RHEL5/e2fsck/profile.c -=================================================================== ---- e2fsprogs-1.39-RHEL5.orig/e2fsck/profile.c -+++ e2fsprogs-1.39-RHEL5/e2fsck/profile.c -@@ -417,8 +417,10 @@ errcode_t profile_open_file(const char * - len += strlen(home_env); - } - expanded_filename = malloc(len); -- if (expanded_filename == 0) -+ if (expanded_filename == 0) { -+ profile_free_file(prf); - return errno; -+ } - if (home_env) { - strcpy(expanded_filename, home_env); - strcat(expanded_filename, filespec+1); -# HG changeset patch -# User tytso@mit.edu -# Date 1174510127 14400 -# Node ID c80153bb3122b949a88a9842239ed9ea617f82b4 -# Parent 54ccaea56d803d9e08740e3a739585aabc802738 -[COVERITY] Fix memory leak in libe2p (e2p_edit_feature) - -Coverity ID: 15: Resource Leak - -Signed-off-by: Brian Behlendorf -Signed-off-by: "Theodore Ts'o" - -Index: e2fsprogs-1.39-RHEL5/lib/e2p/ChangeLog -=================================================================== ---- e2fsprogs-1.39-RHEL5.orig/lib/e2p/ChangeLog -+++ e2fsprogs-1.39-RHEL5/lib/e2p/ChangeLog -@@ -1,3 +1,7 @@ -+2007-03-21 Theodore Tso -+ -+ * feature.c (e2p_edit_feature): Fix memory leak. -+ - 2006-08-30 Theodore Tso - - * percent.c (e2p_percent): Add a new function which accurate and -Index: e2fsprogs-1.39-RHEL5/lib/e2p/feature.c -=================================================================== ---- e2fsprogs-1.39-RHEL5.orig/lib/e2p/feature.c -+++ e2fsprogs-1.39-RHEL5/lib/e2p/feature.c -@@ -151,10 +151,11 @@ static char *skip_over_word(char *cp) - */ - int e2p_edit_feature(const char *str, __u32 *compat_array, __u32 *ok_array) - { -- char *cp, *buf, *next; -- int neg; -+ char *cp, *buf, *next; -+ int neg; - unsigned int mask; - int compat_type; -+ int rc = 0; - - buf = malloc(strlen(str)+1); - if (!buf) -@@ -186,15 +187,19 @@ int e2p_edit_feature(const char *str, __ - cp++; - break; - } -- if (e2p_string2feature(cp, &compat_type, &mask)) -- return 1; -- if (ok_array && !(ok_array[compat_type] & mask)) -- return 1; -+ if (e2p_string2feature(cp, &compat_type, &mask)) { -+ rc = 1; -+ break; -+ } -+ if (ok_array && !(ok_array[compat_type] & mask)) { -+ rc = 1; -+ break; -+ } - if (neg) - compat_array[compat_type] &= ~mask; - else - compat_array[compat_type] |= mask; - } -- return 0; -+ free(buf); -+ return rc; - } -- - -# HG changeset patch -# User tytso@mit.edu -# Date 1174511650 14400 -# Node ID 35af21f328c24bbc37f5d3e31af048bcb3d6a865 -# Parent c80153bb3122b949a88a9842239ed9ea617f82b4 -[COVERITY] Fix memory leak in libe2p (e2p_edit_mntopts) - -Need to free memory allocated to buf. - -Coverity ID: 17: Resource Leak -Coverity ID: 18: Resource Leak - -Signed-off-by: Brian Behlendorf -Signed-off-by: "Theodore Ts'o" - -Index: e2fsprogs-1.39-RHEL5/lib/e2p/ChangeLog -=================================================================== ---- e2fsprogs-1.39-RHEL5.orig/lib/e2p/ChangeLog -+++ e2fsprogs-1.39-RHEL5/lib/e2p/ChangeLog -@@ -1,6 +1,6 @@ - 2007-03-21 Theodore Tso -- -- * feature.c (e2p_edit_feature): Fix memory leak. -+ * feature.c (e2p_edit_feature), mntopts.c (e2p_edit_mntopts): Fix -+ memory leak. - - 2006-08-30 Theodore Tso - -Index: e2fsprogs-1.39-RHEL5/lib/e2p/mntopts.c -=================================================================== ---- e2fsprogs-1.39-RHEL5.orig/lib/e2p/mntopts.c -+++ e2fsprogs-1.39-RHEL5/lib/e2p/mntopts.c -@@ -98,6 +98,7 @@ int e2p_edit_mntopts(const char *str, __ - char *cp, *buf, *next; - int neg; - unsigned int mask; -+ int rc = 0; - - buf = malloc(strlen(str)+1); - if (!buf) -@@ -120,10 +121,14 @@ int e2p_edit_mntopts(const char *str, __ - cp++; - break; - } -- if (e2p_string2mntopt(cp, &mask)) -- return 1; -- if (ok && !(ok & mask)) -- return 1; -+ if (e2p_string2mntopt(cp, &mask)) { -+ rc = 1; -+ break; -+ } -+ if (ok && !(ok & mask)) { -+ rc = 1; -+ break; -+ } - if (mask & EXT3_DEFM_JMODE) - *mntopts &= ~EXT3_DEFM_JMODE; - if (neg) -@@ -132,5 +137,6 @@ int e2p_edit_mntopts(const char *str, __ - *mntopts |= mask; - cp = next ? next+1 : 0; - } -- return 0; -+ free(buf); -+ return rc; - } - -# HG changeset patch -# User tytso@mit.edu -# Date 1174511995 14400 -# Node ID 74de9a3409aefeb23105a766ac76a85bac9f610b -# Parent 4a11c7eb563bb63681e85c0fce725b3359e5043c -[COVERITY] Fix (error case) file handle leak in util/subst program - -Need to close old_f before returning since it had been successfully opened -before. - -Coverity ID: 19: Resource Leak - -Signed-off-by: Brian Behlendorf - -Index: e2fsprogs-1.39-RHEL5/util/ChangeLog -=================================================================== ---- e2fsprogs-1.39-RHEL5.orig/util/ChangeLog -+++ e2fsprogs-1.39-RHEL5/util/ChangeLog -@@ -1,3 +1,8 @@ -+2007-03-21 Theodore Tso -+ -+ * subst.c (compare_file): Close old FILE handle if the new FILE -+ handle open failed. -+ - 2005-10-26 Theodore Ts'o - - * Makefile.in: Use BUILD_CCFLAGS and BUILD_LDFLAGS instead of -Index: e2fsprogs-1.39-RHEL5/util/subst.c -=================================================================== ---- e2fsprogs-1.39-RHEL5.orig/util/subst.c -+++ e2fsprogs-1.39-RHEL5/util/subst.c -@@ -273,8 +273,10 @@ static int compare_file(const char *outf - if (!old_f) - return 0; - new_f = fopen(newfn, "r"); -- if (!new_f) -+ if (!new_f) { -+ fclose(old_f); - return 0; -+ } - - while (1) { - oldcp = fgets(oldbuf, sizeof(oldbuf), old_f); - -# HG changeset patch -# User tytso@mit.edu -# Date 1174512887 14400 -# Node ID 68907ddfca40353a3289789145c551af1ad6f131 -# Parent 74de9a3409aefeb23105a766ac76a85bac9f610b -[COVERITY] Fix memory leak in libss (ss_execute_line) - -Fix a memory leak by freeing the argv[] array if ss_parse_line returns 0 -for argc 0 (which will happen if the user his return and sends an empty -line to the application). - -Potentially need to free argv before early return since it was allocated -memory. Need to be careful since it may be possible for ss_parse() to have -freed the memory allocated to it if it detects an unbalanced set of quotes -passed to it. - -Coverity ID: 21: Resource Leak - -Signed-off-by: Brian Behlendorf - -Index: e2fsprogs-1.39-RHEL5/lib/ss/ChangeLog -=================================================================== ---- e2fsprogs-1.39-RHEL5.orig/lib/ss/ChangeLog -+++ e2fsprogs-1.39-RHEL5/lib/ss/ChangeLog -@@ -1,3 +1,10 @@ -+2007-03-21 Theodore Tso -+ -+ * execute_cmd.c (ss_execute_line): Fix a memory leak by freeing -+ the argv[] array if ss_parse_line returns 0 for argc 0 -+ (which will happen if the user his return and sends an -+ empty line to the application). -+ - 2007-03-19 Theodore Tso - - * help.c (ss_add_info_dir): Fix error checking for NULL parameter -Index: e2fsprogs-1.39-RHEL5/lib/ss/execute_cmd.c -=================================================================== ---- e2fsprogs-1.39-RHEL5.orig/lib/ss/execute_cmd.c -+++ e2fsprogs-1.39-RHEL5/lib/ss/execute_cmd.c -@@ -220,8 +220,11 @@ int ss_execute_line (sci_idx, line_ptr) - - /* parse it */ - argv = ss_parse(sci_idx, line_ptr, &argc); -- if (argc == 0) -+ if (argc == 0) { -+ if (argv) -+ free(argv); - return 0; -+ } - - /* look it up in the request tables, execute if found */ - ret = really_execute_command (sci_idx, argc, &argv); - -# HG changeset patch -# User tytso@mit.edu -# Date 1174513127 14400 -# Node ID 3885e6245a0a595c0ce5ea11bf53f0df5160527d -# Parent 68907ddfca40353a3289789145c551af1ad6f131 -[COVERITY] Fix (error case) memory leak in libext2fs (ext2fs_write_inode_full) - -Need to free w_inode on early exit if w_inode != &temp_inode. - -Coverity ID: 22: Resource Leak - -Signed-off-by: Brian Behlendorf - -Index: e2fsprogs-1.39-RHEL5/lib/ext2fs/ChangeLog -=================================================================== ---- e2fsprogs-1.39-RHEL5.orig/lib/ext2fs/ChangeLog -+++ e2fsprogs-1.39-RHEL5/lib/ext2fs/ChangeLog -@@ -1,3 +1,8 @@ -+2007-03-21 Theodore Tso -+ -+ * inode.c (ext2fs_write_inode_full): Fix memory leak on error -+ return (when the inode table is missing). -+ - 2006-08-30 Eric Sandeen - - * alloc_tables.c (ext2fs_allocate_group_table): -Index: e2fsprogs-1.39-RHEL5/lib/ext2fs/inode.c -=================================================================== ---- e2fsprogs-1.39-RHEL5.orig/lib/ext2fs/inode.c -+++ e2fsprogs-1.39-RHEL5/lib/ext2fs/inode.c -@@ -669,8 +669,10 @@ errcode_t ext2fs_write_inode_full(ext2_f - offset = ((ino - 1) % EXT2_INODES_PER_GROUP(fs->super)) * - EXT2_INODE_SIZE(fs->super); - block = offset >> EXT2_BLOCK_SIZE_BITS(fs->super); -- if (!fs->group_desc[(unsigned) group].bg_inode_table) -- return EXT2_ET_MISSING_INODE_TABLE; -+ if (!fs->group_desc[(unsigned) group].bg_inode_table) { -+ retval = EXT2_ET_MISSING_INODE_TABLE; -+ goto errout; -+ } - block_nr = fs->group_desc[(unsigned) group].bg_inode_table + block; - - offset &= (EXT2_BLOCK_SIZE(fs->super) - 1); - -# HG changeset patch -# User tytso@mit.edu -# Date 1174513417 14400 -# Node ID 972658aa60ac87100f9cee0f088a69bf76cd4358 -# Parent 3885e6245a0a595c0ce5ea11bf53f0df5160527d -[COVERITY] Fix (error case) memory leak in libext2fs (ext2fs_image_inode_write) - -Use pre-existing early exit label in function to handle proper -error code return and local memory allocation cleanup. - -Coverity ID: 23: Resource Leak - -Signed-off-by: Brian Behlendorf - -Index: e2fsprogs-1.39-RHEL5/lib/ext2fs/ChangeLog -=================================================================== ---- e2fsprogs-1.39-RHEL5.orig/lib/ext2fs/ChangeLog -+++ e2fsprogs-1.39-RHEL5/lib/ext2fs/ChangeLog -@@ -1,7 +1,8 @@ - 2007-03-21 Theodore Tso - -- * inode.c (ext2fs_write_inode_full): Fix memory leak on error -- return (when the inode table is missing). -+ * imager.c (ext2fs_image_inode_write), inode.c -+ (ext2fs_write_inode_full): Fix memory leak on error return -+ (when the inode table is missing). - - 2006-08-30 Eric Sandeen - -Index: e2fsprogs-1.39-RHEL5/lib/ext2fs/imager.c -=================================================================== ---- e2fsprogs-1.39-RHEL5.orig/lib/ext2fs/imager.c -+++ e2fsprogs-1.39-RHEL5/lib/ext2fs/imager.c -@@ -72,8 +72,10 @@ errcode_t ext2fs_image_inode_write(ext2_ - - for (group = 0; group < fs->group_desc_count; group++) { - blk = fs->group_desc[(unsigned)group].bg_inode_table; -- if (!blk) -- return EXT2_ET_MISSING_INODE_TABLE; -+ if (!blk) { -+ retval = EXT2_ET_MISSING_INODE_TABLE; -+ goto errout; -+ } - left = fs->inode_blocks_per_group; - while (left) { - c = BUF_BLOCKS; - -# HG changeset patch -# User tytso@mit.edu -# Date 1174514013 14400 -# Node ID 1a1e76e5c7a371d6ea3f4eba25033de2a39c8799 -# Parent 972658aa60ac87100f9cee0f088a69bf76cd4358 -[COVERITY] Fix (error case) memory leak in debugfs - -Handle leaked cbuf due to early returns with a generic failure path. - -Coverity ID: 24: Resource Leak - -Signed-off-by: Brian Behlendorf -Signed-off-by: "Theodore Ts'o" - -Index: e2fsprogs-1.39-RHEL5/debugfs/ChangeLog -=================================================================== ---- e2fsprogs-1.39-RHEL5.orig/debugfs/ChangeLog -+++ e2fsprogs-1.39-RHEL5/debugfs/ChangeLog -@@ -1,5 +1,7 @@ - 2007-03-21 Theodore Tso - -+ * htree.c (htree_dump_int_block): Fix memory leak on error paths. -+ - * dump.c (rdump_dirent), htree.c (htree_dump_leaf_node), - ls.c (list_dir_proc): Add an extra byte to EXT2_NAME_LEN - to avoid the possibility of an array overrun if the -Index: e2fsprogs-1.39-RHEL5/debugfs/htree.c -=================================================================== ---- e2fsprogs-1.39-RHEL5.orig/debugfs/htree.c -+++ e2fsprogs-1.39-RHEL5/debugfs/htree.c -@@ -156,19 +156,20 @@ static void htree_dump_int_block(ext2_fi - if (errcode) { - com_err("htree_dump_int_block", errcode, - "while mapping logical block %u\n", blk); -- return; -+ goto errout; - } - - errcode = io_channel_read_blk(current_fs->io, pblk, 1, buf); - if (errcode) { - com_err("htree_dump_int_block", errcode, - "while reading block %u\n", blk); -- return; -+ goto errout; - } - - htree_dump_int_node(fs, ino, inode, rootnode, - (struct ext2_dx_entry *) (buf+8), - cbuf, level); -+errout: - free(cbuf); - } - - -# HG changeset patch -# User tytso@mit.edu -# Date 1174518971 14400 -# Node ID cfa5b6c5fab5b3e46d068205e6f045e34b02faab -# Parent 1a1e76e5c7a371d6ea3f4eba25033de2a39c8799 -[COVERITY] Fix memory leak on error handling in the debugfs's icheck command - -Coverity ID: 25: Resource Leak - -Signed-off-by: Brian Behlendorf - -Index: e2fsprogs-1.39-RHEL5/debugfs/ChangeLog -=================================================================== ---- e2fsprogs-1.39-RHEL5.orig/debugfs/ChangeLog -+++ e2fsprogs-1.39-RHEL5/debugfs/ChangeLog -@@ -1,5 +1,8 @@ - 2007-03-21 Theodore Tso - -+ * icheck.c (do_icheck): Fix memory leak and clean up error -+ handling paths. -+ - * htree.c (htree_dump_int_block): Fix memory leak on error paths. - - * dump.c (rdump_dirent), htree.c (htree_dump_leaf_node), -Index: e2fsprogs-1.39-RHEL5/debugfs/icheck.c -=================================================================== ---- e2fsprogs-1.39-RHEL5.orig/debugfs/icheck.c -+++ e2fsprogs-1.39-RHEL5/debugfs/icheck.c -@@ -86,7 +86,7 @@ void do_icheck(int argc, char **argv) - - for (i=1; i < argc; i++) { - if (strtoblk(argv[0], argv[i], &bw.barray[i-1].blk)) -- return; -+ goto error_out; - } - - bw.num_blocks = bw.blocks_left = argc-1; -@@ -160,7 +160,8 @@ void do_icheck(int argc, char **argv) - - error_out: - free(bw.barray); -- free(block_buf); -+ if (block_buf) -+ free(block_buf); - if (scan) - ext2fs_close_inode_scan(scan); - return; - -# HG changeset patch -# User tytso@mit.edu -# Date 1174518993 14400 -# Node ID e480993060b28c885da1c98c1e7a350a2fc1eda7 -# Parent cfa5b6c5fab5b3e46d068205e6f045e34b02faab -[COVERITY] Fix memory leak in e2image - -zero_buf and buf must be freed on return from the -output_meta_data_blocks() function. - -Coverity ID: 26+27: Resource Leak - -Signed-off-by: Brian Behlendorf - -Index: e2fsprogs-1.39-RHEL5/misc/ChangeLog -=================================================================== ---- e2fsprogs-1.39-RHEL5.orig/misc/ChangeLog -+++ e2fsprogs-1.39-RHEL5/misc/ChangeLog -@@ -1,3 +1,7 @@ -+2007-03-21 Theodore Tso -+ -+ * e2image.c (output_meta_data_blocks): Fix memory leak. -+ - 2006-08-30 Eric Sandeen - - * mke2fs.c (PRS): Avoid overflow in megs calculation. -Index: e2fsprogs-1.39-RHEL5/misc/e2image.c -=================================================================== ---- e2fsprogs-1.39-RHEL5.orig/misc/e2image.c -+++ e2fsprogs-1.39-RHEL5/misc/e2image.c -@@ -441,6 +441,8 @@ static void output_meta_data_blocks(ext2 - } - } - write_block(fd, zero_buf, sparse, 1, -1); -+ free(zero_buf); -+ free(buf); - } - - static void write_raw_image_file(ext2_filsys fs, int fd, int scramble_flag) - -# HG changeset patch -# User tytso@mit.edu -# Date 1174519012 14400 -# Node ID 76ed8e6813754f21ed37b1db5f2f1e792b228201 -# Parent e480993060b28c885da1c98c1e7a350a2fc1eda7 -[COVERITY] Fix memory leak in e2image (write_raw_image_file) - -Coverity ID: 28: Resource Leak - -Signed-off-by: Brian Behlendorf - -Index: e2fsprogs-1.39-RHEL5/misc/ChangeLog -=================================================================== ---- e2fsprogs-1.39-RHEL5.orig/misc/ChangeLog -+++ e2fsprogs-1.39-RHEL5/misc/ChangeLog -@@ -1,6 +1,7 @@ - 2007-03-21 Theodore Tso - -- * e2image.c (output_meta_data_blocks): Fix memory leak. -+ * e2image.c (output_meta_data_blocks, write_raw_image_file): Fix -+ memory leak. - - 2006-08-30 Eric Sandeen - -Index: e2fsprogs-1.39-RHEL5/misc/e2image.c -=================================================================== ---- e2fsprogs-1.39-RHEL5.orig/misc/e2image.c -+++ e2fsprogs-1.39-RHEL5/misc/e2image.c -@@ -539,6 +539,7 @@ static void write_raw_image_file(ext2_fi - } - use_inode_shortcuts(fs, 0); - output_meta_data_blocks(fs, fd); -+ free(block_buf); - } - - static void install_image(char *device, char *image_fn, int raw_flag) - -# HG changeset patch -# User tytso@mit.edu -# Date 1174704959 14400 -# Node ID 0c78001fe1cfdd87a23a416df5382a01d0c36822 -# Parent 76ed8e6813754f21ed37b1db5f2f1e792b228201 -[COVERITY] Fix (error case) memory leak in blkid library (parse_dev) - -Coverity ID: 29: Resource Leak - -Signed-off-by: Brian Behlendorf -Signed-off-by: "Theodore Ts'o" - -Index: e2fsprogs-1.39-RHEL5/lib/blkid/ChangeLog -=================================================================== ---- e2fsprogs-1.39-RHEL5.orig/lib/blkid/ChangeLog -+++ e2fsprogs-1.39-RHEL5/lib/blkid/ChangeLog -@@ -2,6 +2,10 @@ - - * probe.c (probe_luks): Add support for cryptsetup-luks partitions - -+2007-03-23 Theodore Tso -+ -+ * read.c (parse_dev): Fix memory leak on error path. -+ - 2006-09-17 Karel Zak - - * probe.c (probe_fat): Fix problem with empty FAT label. -Index: e2fsprogs-1.39-RHEL5/lib/blkid/read.c -=================================================================== ---- e2fsprogs-1.39-RHEL5.orig/lib/blkid/read.c -+++ e2fsprogs-1.39-RHEL5/lib/blkid/read.c -@@ -223,8 +223,10 @@ static int parse_dev(blkid_cache cache, - - DBG(DEBUG_READ, printf("found dev %s\n", name)); - -- if (!(*dev = blkid_get_dev(cache, name, BLKID_DEV_CREATE))) -+ if (!(*dev = blkid_get_dev(cache, name, BLKID_DEV_CREATE))) { -+ free(name); - return -BLKID_ERR_MEM; -+ } - - free(name); - return 1; - -# HG changeset patch -# User tytso@mit.edu -# Date 1174705269 14400 -# Node ID 5b0d17e905ca2c472c69c5da4f0652dfe6bed6e4 -# Parent 0c78001fe1cfdd87a23a416df5382a01d0c36822 -[COVERITY] Fix file handle leak in debugfs's logdump (in error case) - -Also fixed a bug in checking if the fopen failed. - -Coverity ID: 30: Resource Leak - -Signed-off-by: Brian Behlendorf -Signed-off-by: "Theodore Ts'o" - -Index: e2fsprogs-1.39-RHEL5/debugfs/ChangeLog -=================================================================== ---- e2fsprogs-1.39-RHEL5.orig/debugfs/ChangeLog -+++ e2fsprogs-1.39-RHEL5/debugfs/ChangeLog -@@ -1,3 +1,8 @@ -+2007-03-23 Theodore Tso -+ -+ * logdump.c (do_logdump): Fix file handle leak if logdump fails -+ with an error. -+ - 2007-03-21 Theodore Tso - - * icheck.c (do_icheck): Fix memory leak and clean up error -Index: e2fsprogs-1.39-RHEL5/debugfs/logdump.c -=================================================================== ---- e2fsprogs-1.39-RHEL5.orig/debugfs/logdump.c -+++ e2fsprogs-1.39-RHEL5/debugfs/logdump.c -@@ -170,10 +170,10 @@ void do_logdump(int argc, char **argv) - } else { - out_fn = argv[optind]; - out_file = fopen(out_fn, "w"); -- if (!out_file < 0) { -+ if (!out_file) { - com_err(argv[0], errno, "while opening %s for logdump", - out_fn); -- return; -+ goto errout; - } - } - -@@ -185,7 +185,7 @@ void do_logdump(int argc, char **argv) - } - - if (!journal_fn && check_fs_open(argv[0])) -- return; -+ goto errout; - - if (journal_fn) { - /* Set up to read journal from a regular file somewhere */ -@@ -193,7 +193,7 @@ void do_logdump(int argc, char **argv) - if (journal_fd < 0) { - com_err(argv[0], errno, "while opening %s for logdump", - journal_fn); -- return; -+ goto errout; - } - - journal_source.where = JOURNAL_IS_EXTERNAL; -@@ -203,7 +203,7 @@ void do_logdump(int argc, char **argv) - if (es->s_jnl_backup_type != EXT3_JNL_BACKUP_BLOCKS) { - com_err(argv[0], 0, - "no journal backup in super block\n"); -- return; -+ goto errout; - } - memset(&journal_inode, 0, sizeof(struct ext2_inode)); - memcpy(&journal_inode.i_block[0], es->s_jnl_blocks, -@@ -214,14 +214,14 @@ void do_logdump(int argc, char **argv) - } else { - if (debugfs_read_inode(journal_inum, &journal_inode, - argv[0])) -- return; -+ goto errout; - } - - retval = ext2fs_file_open2(current_fs, journal_inum, - &journal_inode, 0, &journal_file); - if (retval) { - com_err(argv[0], retval, "while opening ext2 file"); -- return; -+ goto errout; - } - journal_source.where = JOURNAL_IS_INTERNAL; - journal_source.file = journal_file; -@@ -234,14 +234,14 @@ void do_logdump(int argc, char **argv) - journal_fn = blkid_devno_to_devname(es->s_journal_dev); - if (!journal_fn) { - com_err(argv[0], 0, "filesystem has no journal"); -- return; -+ goto errout; - } - journal_fd = open(journal_fn, O_RDONLY, 0); - if (journal_fd < 0) { - com_err(argv[0], errno, "while opening %s for logdump", - journal_fn); - free(journal_fn); -- return; -+ goto errout; - } - fprintf(out_file, "Using external journal found at %s\n", - journal_fn); -@@ -257,6 +257,7 @@ void do_logdump(int argc, char **argv) - else - close(journal_fd); - -+errout: - if (out_file != stdout) - fclose(out_file); - - -# HG changeset patch -# User tytso@mit.edu -# Date 1175089687 14400 -# Node ID e5b520d1790cc02fbd1492e097b734cf6a734424 -# Parent 5b0d17e905ca2c472c69c5da4f0652dfe6bed6e4 -[COVERITY] Fix memory leak in fsck on error paths - -The memory allocated by inst is not reclaimed. There also was a -call to exit that coverity did not catch the resource leak. This -might not really be a big issue since the memory will be freed when -fsck exits, but it should be done anyway imho. - -Coverity ID: 32: Resource Leak - -Signed-off-by: Brian Behlendorf - -Index: e2fsprogs-1.39-RHEL5/misc/ChangeLog -=================================================================== ---- e2fsprogs-1.39-RHEL5.orig/misc/ChangeLog -+++ e2fsprogs-1.39-RHEL5/misc/ChangeLog -@@ -1,3 +1,7 @@ -+2007-03-28 Theodore Tso -+ -+ * fsck.c (execute): Fix memory leak on error paths -+ - 2007-03-21 Theodore Tso - - * e2image.c (output_meta_data_blocks, write_raw_image_file): Fix -Index: e2fsprogs-1.39-RHEL5/misc/fsck.c -=================================================================== ---- e2fsprogs-1.39-RHEL5.orig/misc/fsck.c -+++ e2fsprogs-1.39-RHEL5/misc/fsck.c -@@ -470,6 +470,7 @@ static int execute(const char *type, con - s = find_fsck(prog); - if (s == NULL) { - fprintf(stderr, _("fsck: %s: not found\n"), prog); -+ free(inst); - return ENOENT; - } - -@@ -486,12 +487,14 @@ static int execute(const char *type, con - pid = -1; - else if ((pid = fork()) < 0) { - perror("fork"); -+ free(inst); - return errno; - } else if (pid == 0) { - if (!interactive) - close(0); - (void) execv(s, argv); - perror(argv[0]); -+ free(inst); - exit(EXIT_ERROR); - } - - -# HG changeset patch -# User tytso@mit.edu -# Date 1175089833 14400 -# Node ID 14bbf7a55b751c218e22667911bd06ffa1060844 -# Parent e5b520d1790cc02fbd1492e097b734cf6a734424 -[COVERITY] Fix memory leak in tune2fs and mke2fs when parsing journal options - -Coverity ID: 33: Resource Leak - -Signed-off-by: Brian Behlendorf -Signed-off-by: "Theodore Ts'o" - -Index: e2fsprogs-1.39-RHEL5/misc/ChangeLog -=================================================================== ---- e2fsprogs-1.39-RHEL5.orig/misc/ChangeLog -+++ e2fsprogs-1.39-RHEL5/misc/ChangeLog -@@ -1,5 +1,7 @@ - 2007-03-28 Theodore Tso - -+ * util.c (parse_journal_opts): Fix memory leak -+ - * fsck.c (execute): Fix memory leak on error paths - - 2007-03-21 Theodore Tso -Index: e2fsprogs-1.39-RHEL5/misc/util.c -=================================================================== ---- e2fsprogs-1.39-RHEL5.orig/misc/util.c -+++ e2fsprogs-1.39-RHEL5/misc/util.c -@@ -234,8 +234,10 @@ void parse_journal_opts(const char *opts - "\tdevice=\n\n" - "The journal size must be between " - "1024 and 102400 filesystem blocks.\n\n"), stderr); -+ free(buf); - exit(1); - } -+ free(buf); - } - - /* - -# HG changeset patch -# User tytso@mit.edu -# Date 1180625447 14400 -# Node ID dd13025ad0d7299f905e1ac8548a283466e8304c -# Parent 7ff0d3542dae9c4aff72f9570032a6b5d1bfb5d5 -[COVERITY] Free memory leak in mke2fs when parsing extended options - -Coverity ID: 34: Resource Leak - -Signed-off-by: Brian Behlendorf -Signed-off-by: "Theodore Ts'o" - -Index: e2fsprogs-1.39-RHEL5/misc/ChangeLog -=================================================================== ---- e2fsprogs-1.39-RHEL5.orig/misc/ChangeLog -+++ e2fsprogs-1.39-RHEL5/misc/ChangeLog -@@ -1,3 +1,7 @@ -+2007-05-31 Theodore Tso -+ -+ * mke2fs.c (parse_extended_opts): Free allocated buf on return -+ - 2007-03-28 Theodore Tso - - * util.c (parse_journal_opts): Fix memory leak -Index: e2fsprogs-1.39-RHEL5/misc/mke2fs.c -=================================================================== ---- e2fsprogs-1.39-RHEL5.orig/misc/mke2fs.c -+++ e2fsprogs-1.39-RHEL5/misc/mke2fs.c -@@ -846,8 +846,10 @@ static void parse_extended_opts(struct e - "Valid extended options are:\n" - "\tstride=\n" - "\tresize=\n\n")); -+ free(buf); - exit(1); - } -+ free(buf); - } - - static __u32 ok_features[3] = { - -# HG changeset patch -# User tytso@mit.edu -# Date 1175095704 14400 -# Node ID c74ac4ed81554417e27828d240bfd57e5cc2e376 -# Parent 14bbf7a55b751c218e22667911bd06ffa1060844 -[COVERITY] Fix memory leak when parsing extended options in e2fsck - -Coverity ID: 35: Resource Leak - -Signed-off-by: Brian Behlendorf - -Index: e2fsprogs-1.39-RHEL5/e2fsck/ChangeLog -=================================================================== ---- e2fsprogs-1.39-RHEL5.orig/e2fsck/ChangeLog -+++ e2fsprogs-1.39-RHEL5/e2fsck/ChangeLog -@@ -1,3 +1,7 @@ -+2007-03-28 Theodore Tso -+ -+ * unix.c (parse_extended_opts): Fix memory leak -+ - 2007-03-21 Theodore Tso - - * profile.c (profile_open_file): Fix memory leak if malloc() fails -Index: e2fsprogs-1.39-RHEL5/e2fsck/unix.c -=================================================================== ---- e2fsprogs-1.39-RHEL5.orig/e2fsck/unix.c -+++ e2fsprogs-1.39-RHEL5/e2fsck/unix.c -@@ -523,7 +523,7 @@ static void parse_extended_opts(e2fsck_t - if (p) { - *p = 0; - next = p+1; -- } -+ } - arg = strchr(token, '='); - if (arg) { - *arg = 0; -@@ -549,6 +549,8 @@ static void parse_extended_opts(e2fsck_t - extended_usage++; - } - } -+ free(buf); -+ - if (extended_usage) { - fputs(("\nExtended options are separated by commas, " - "and may take an argument which\n" -@@ -557,7 +559,7 @@ static void parse_extended_opts(e2fsck_t - "\tea_ver=\n\n"), stderr); - exit(1); - } --} -+} - - static void syntax_err_report(const char *filename, long err, int line_num) - { - -# HG changeset patch -# User tytso@mit.edu -# Date 1175096500 14400 -# Node ID fbeefe85b80a7614e3dae5d9df3480acae777956 -# Parent c74ac4ed81554417e27828d240bfd57e5cc2e376 -[COVERITY] Fix memory leak when parsing extended options in e2fsck - -Coverity ID: 36: Resource Leak - -Signed-off-by: Brian Behlendorf - -Index: e2fsprogs-1.39-RHEL5/e2fsck/ChangeLog -=================================================================== ---- e2fsprogs-1.39-RHEL5.orig/e2fsck/ChangeLog -+++ e2fsprogs-1.39-RHEL5/e2fsck/ChangeLog -@@ -1,6 +1,7 @@ - 2007-03-28 Theodore Tso - -- * unix.c (parse_extended_opts): Fix memory leak -+ * pass1.c (check_ext_attr), unix.c (parse_extended_opts): Fix -+ memory leak - - 2007-03-21 Theodore Tso - -Index: e2fsprogs-1.39-RHEL5/e2fsck/pass1.c -=================================================================== ---- e2fsprogs-1.39-RHEL5.orig/e2fsck/pass1.c -+++ e2fsprogs-1.39-RHEL5/e2fsck/pass1.c -@@ -1161,7 +1161,7 @@ static int check_ext_attr(e2fsck_t ctx, - struct ext2_ext_attr_entry *entry; - int count; - region_t region; -- -+ - blk = inode->i_file_acl; - if (blk == 0) - return 0; -@@ -1227,7 +1227,7 @@ static int check_ext_attr(e2fsck_t ctx, - ea_refcount_increment(ctx->refcount_extra, blk, 0); - return 1; - } -- -+ - /* - * OK, we haven't seen this EA block yet. So we need to - * validate it -@@ -1261,7 +1261,7 @@ static int check_ext_attr(e2fsck_t ctx, - if (fix_problem(ctx, PR_1_EA_ALLOC_COLLISION, pctx)) - goto clear_extattr; - } -- -+ - entry = (struct ext2_ext_attr_entry *)(header+1); - end = block_buf + fs->blocksize; - while ((char *)entry < end && *(__u32 *)entry) { -@@ -1300,10 +1300,11 @@ static int check_ext_attr(e2fsck_t ctx, - ea_refcount_store(ctx->refcount, blk, count); - mark_block_used(ctx, blk); - ext2fs_fast_mark_block_bitmap(ctx->block_ea_map, blk); -- - return 1; - - clear_extattr: -+ if (region) -+ region_free(region); - inode->i_file_acl = 0; - e2fsck_write_inode(ctx, ino, inode, "check_ext_attr"); - return 0; - -# HG changeset patch -# User tytso@mit.edu -# Date 1175097440 14400 -# Node ID 631e7131571ffb7e7590cc32e145179ec2bf5038 -# Parent fbeefe85b80a7614e3dae5d9df3480acae777956 -[COVERITY] Fix (error case only) memory leak in e2fsck pass #1 - -Coverity ID: 37: Resource Leak -Coverity ID: 38: Resource Leak - -Signed-off-by: Brian Behlendorf - -Index: e2fsprogs-1.39-RHEL5/e2fsck/ChangeLog -=================================================================== ---- e2fsprogs-1.39-RHEL5.orig/e2fsck/ChangeLog -+++ e2fsprogs-1.39-RHEL5/e2fsck/ChangeLog -@@ -1,7 +1,7 @@ - 2007-03-28 Theodore Tso - -- * pass1.c (check_ext_attr), unix.c (parse_extended_opts): Fix -- memory leak -+ * pass1.c (e2fsck_pass1, check_ext_attr), -+ unix.c (parse_extended_opts): Fix memory leak - - 2007-03-21 Theodore Tso - -Index: e2fsprogs-1.39-RHEL5/e2fsck/pass1.c -=================================================================== ---- e2fsprogs-1.39-RHEL5.orig/e2fsck/pass1.c -+++ e2fsprogs-1.39-RHEL5/e2fsck/pass1.c -@@ -481,6 +481,7 @@ void e2fsck_pass1(e2fsck_t ctx) - if (pctx.errcode) { - fix_problem(ctx, PR_1_ALLOCATE_DBCOUNT, &pctx); - ctx->flags |= E2F_FLAG_ABORT; -+ ext2fs_free_mem(&inode); - return; - } - -@@ -508,6 +509,8 @@ void e2fsck_pass1(e2fsck_t ctx) - if (pctx.errcode) { - fix_problem(ctx, PR_1_ISCAN_ERROR, &pctx); - ctx->flags |= E2F_FLAG_ABORT; -+ ext2fs_free_mem(&block_buf); -+ ext2fs_free_mem(&inode); - return; - } - ext2fs_inode_scan_flags(scan, EXT2_SF_SKIP_MISSING_ITABLE, 0); - -# HG changeset patch -# User tytso@mit.edu -# Date 1175098061 14400 -# Node ID 7990a50a0b52a4d276c4dbfa45b6e966aff73bdf -# Parent 631e7131571ffb7e7590cc32e145179ec2bf5038 -[COVERITY] Fix (error case only) memory leak in e2fsck pass #5 - -Coverity ID: 39: Resource Leak -Coverity ID: 40: Resource Leak - -Signed-off-by: Brian Behlendorf - -Index: e2fsprogs-1.39-RHEL5/e2fsck/ChangeLog -=================================================================== ---- e2fsprogs-1.39-RHEL5.orig/e2fsck/ChangeLog -+++ e2fsprogs-1.39-RHEL5/e2fsck/ChangeLog -@@ -1,7 +1,8 @@ - 2007-03-28 Theodore Tso - - * pass1.c (e2fsck_pass1, check_ext_attr), -- unix.c (parse_extended_opts): Fix memory leak -+ pass5.c (check_block_bitmaps, check_inode_bitmaps): -+ unix.c (parse_extended_opts): Fix memory leaks - - 2007-03-21 Theodore Tso - -Index: e2fsprogs-1.39-RHEL5/e2fsck/pass5.c -=================================================================== ---- e2fsprogs-1.39-RHEL5.orig/e2fsck/pass5.c -+++ e2fsprogs-1.39-RHEL5/e2fsck/pass5.c -@@ -107,7 +107,7 @@ static void print_bitmap_problem(e2fsck_ - pctx->blk = pctx->blk2 = NO_BLK; - pctx->ino = pctx->ino2 = 0; - } -- -+ - static void check_block_bitmaps(e2fsck_t ctx) - { - ext2_filsys fs = ctx->fs; -@@ -123,7 +123,7 @@ static void check_block_bitmaps(e2fsck_t - errcode_t retval; - int lazy_bg = 0; - int skip_group = 0; -- -+ - clear_problem_context(&pctx); - free_array = (int *) e2fsck_allocate_memory(ctx, - fs->group_desc_count * sizeof(int), "free block count array"); -@@ -140,9 +140,9 @@ static void check_block_bitmaps(e2fsck_t - fix_problem(ctx, PR_5_BMAP_ENDPOINTS, &pctx); - - ctx->flags |= E2F_FLAG_ABORT; /* fatal */ -- return; -+ goto errout; - } -- -+ - if ((fs->super->s_first_data_block < - ext2fs_get_block_bitmap_start(fs->block_map)) || - (fs->super->s_blocks_count-1 > -@@ -155,11 +155,10 @@ static void check_block_bitmaps(e2fsck_t - fix_problem(ctx, PR_5_BMAP_ENDPOINTS, &pctx); - - ctx->flags |= E2F_FLAG_ABORT; /* fatal */ -- return; -+ goto errout; - } -- -- if (EXT2_HAS_COMPAT_FEATURE(fs->super, -- EXT2_FEATURE_COMPAT_LAZY_BG)) -+ -+ if (EXT2_HAS_COMPAT_FEATURE(fs->super, EXT2_FEATURE_COMPAT_LAZY_BG)) - lazy_bg++; - - redo_counts: -@@ -193,7 +192,7 @@ redo_counts: - actual = (actual != 0); - } else - bitmap = ext2fs_fast_test_block_bitmap(fs->block_map, i); -- -+ - if (actual == bitmap) - goto do_counts; - -@@ -223,7 +222,7 @@ redo_counts: - } - ctx->flags |= E2F_FLAG_PROG_SUPPRESS; - had_problem++; -- -+ - do_counts: - if (!bitmap && !skip_group) { - group_free++; -@@ -241,7 +240,7 @@ redo_counts: - if (ctx->progress) - if ((ctx->progress)(ctx, 5, group, - fs->group_desc_count*2)) -- return; -+ goto errout; - if (lazy_bg && - (i != fs->super->s_blocks_count-1) && - (fs->group_desc[group].bg_flags & -@@ -256,7 +255,7 @@ redo_counts: - else - fixit = -1; - ctx->flags &= ~E2F_FLAG_PROG_SUPPRESS; -- -+ - if (fixit == 1) { - ext2fs_free_block_bitmap(fs->block_map); - retval = ext2fs_copy_bitmap(ctx->block_found_map, -@@ -265,11 +264,11 @@ redo_counts: - clear_problem_context(&pctx); - fix_problem(ctx, PR_5_COPY_BBITMAP_ERROR, &pctx); - ctx->flags |= E2F_FLAG_ABORT; -- return; -+ goto errout; - } - ext2fs_set_bitmap_padding(fs->block_map); - ext2fs_mark_bb_dirty(fs); -- -+ - /* Redo the counts */ - blocks = 0; free_blocks = 0; group_free = 0; group = 0; - memset(free_array, 0, fs->group_desc_count * sizeof(int)); -@@ -303,9 +302,10 @@ redo_counts: - } else - ext2fs_unmark_valid(fs); - } -+errout: - ext2fs_free_mem(&free_array); - } -- -+ - static void check_inode_bitmaps(e2fsck_t ctx) - { - ext2_filsys fs = ctx->fs; -@@ -323,16 +323,16 @@ static void check_inode_bitmaps(e2fsck_t - int problem, save_problem, fixit, had_problem; - int lazy_bg = 0; - int skip_group = 0; -- -+ - clear_problem_context(&pctx); - free_array = (int *) e2fsck_allocate_memory(ctx, - fs->group_desc_count * sizeof(int), "free inode count array"); -- -+ - dir_array = (int *) e2fsck_allocate_memory(ctx, - fs->group_desc_count * sizeof(int), "directory count array"); -- -+ - if ((1 < ext2fs_get_inode_bitmap_start(ctx->inode_used_map)) || -- (fs->super->s_inodes_count > -+ (fs->super->s_inodes_count > - ext2fs_get_inode_bitmap_end(ctx->inode_used_map))) { - pctx.num = 3; - pctx.blk = 1; -@@ -342,10 +342,10 @@ static void check_inode_bitmaps(e2fsck_t - fix_problem(ctx, PR_5_BMAP_ENDPOINTS, &pctx); - - ctx->flags |= E2F_FLAG_ABORT; /* fatal */ -- return; -+ goto errout; - } - if ((1 < ext2fs_get_inode_bitmap_start(fs->inode_map)) || -- (fs->super->s_inodes_count > -+ (fs->super->s_inodes_count > - ext2fs_get_inode_bitmap_end(fs->inode_map))) { - pctx.num = 4; - pctx.blk = 1; -@@ -355,10 +355,10 @@ static void check_inode_bitmaps(e2fsck_t - fix_problem(ctx, PR_5_BMAP_ENDPOINTS, &pctx); - - ctx->flags |= E2F_FLAG_ABORT; /* fatal */ -- return; -+ goto errout; - } - -- if (EXT2_HAS_COMPAT_FEATURE(fs->super, -+ if (EXT2_HAS_COMPAT_FEATURE(fs->super, - EXT2_FEATURE_COMPAT_LAZY_BG)) - lazy_bg++; - -@@ -373,13 +373,13 @@ redo_counts: - /* Protect loop from wrap-around if inodes_count is maxed */ - for (i = 1; i <= fs->super->s_inodes_count && i > 0; i++) { - actual = ext2fs_fast_test_inode_bitmap(ctx->inode_used_map, i); -- if (skip_group) -+ if (skip_group) - bitmap = 0; - else - bitmap = ext2fs_fast_test_inode_bitmap(fs->inode_map, i); - if (actual == bitmap) - goto do_counts; -- -+ - if (!actual && bitmap) { - /* - * Inode wasn't used, but marked in bitmap -@@ -406,7 +406,7 @@ redo_counts: - } - ctx->flags |= E2F_FLAG_PROG_SUPPRESS; - had_problem++; -- -+ - do_counts: - if (bitmap) { - if (ext2fs_test_inode_bitmap(ctx->inode_dir_map, i)) -@@ -429,7 +429,7 @@ do_counts: - if ((ctx->progress)(ctx, 5, - group + fs->group_desc_count, - fs->group_desc_count*2)) -- return; -+ goto errout; - if (lazy_bg && - (i != fs->super->s_inodes_count) && - (fs->group_desc[group].bg_flags & -@@ -439,13 +439,13 @@ do_counts: - } - if (pctx.ino) - print_bitmap_problem(ctx, save_problem, &pctx); -- -+ - if (had_problem) - fixit = end_problem_latch(ctx, PR_LATCH_IBITMAP); - else - fixit = -1; - ctx->flags &= ~E2F_FLAG_PROG_SUPPRESS; -- -+ - if (fixit == 1) { - ext2fs_free_inode_bitmap(fs->inode_map); - retval = ext2fs_copy_bitmap(ctx->inode_used_map, -@@ -454,7 +454,7 @@ do_counts: - clear_problem_context(&pctx); - fix_problem(ctx, PR_5_COPY_IBITMAP_ERROR, &pctx); - ctx->flags |= E2F_FLAG_ABORT; -- return; -+ goto errout; - } - ext2fs_set_bitmap_padding(fs->inode_map); - ext2fs_mark_ib_dirty(fs); -@@ -467,7 +467,7 @@ do_counts: - goto redo_counts; - } else if (fixit == 0) - ext2fs_unmark_valid(fs); -- -+ - for (i = 0; i < fs->group_desc_count; i++) { - if (free_array[i] != fs->group_desc[i].bg_free_inodes_count) { - pctx.group = i; -@@ -506,6 +506,7 @@ do_counts: - } else - ext2fs_unmark_valid(fs); - } -+errout: - ext2fs_free_mem(&free_array); - ext2fs_free_mem(&dir_array); - } - -# HG changeset patch -# User tytso@mit.edu -# Date 1175099801 14400 -# Node ID 41169d959e94ac9713a7c781a8a195e73a06b1ff -# Parent 7990a50a0b52a4d276c4dbfa45b6e966aff73bdf -[COVERITY] Fix (error case only) memory leak in e2fsck -S - -Coverity ID: 41: Resource Leak - -Signed-off-by: Brian Behlendorf -Signed-off-by: "Theodore Ts'o" - -Index: e2fsprogs-1.39-RHEL5/e2fsck/ChangeLog -=================================================================== ---- e2fsprogs-1.39-RHEL5.orig/e2fsck/ChangeLog -+++ e2fsprogs-1.39-RHEL5/e2fsck/ChangeLog -@@ -1,7 +1,8 @@ - 2007-03-28 Theodore Tso - - * pass1.c (e2fsck_pass1, check_ext_attr), -- pass5.c (check_block_bitmaps, check_inode_bitmaps): -+ pass5.c (check_block_bitmaps, check_inode_bitmaps), -+ swapfs.c (swap_inodes), - unix.c (parse_extended_opts): Fix memory leaks - - 2007-03-21 Theodore Tso -Index: e2fsprogs-1.39-RHEL5/e2fsck/swapfs.c -=================================================================== ---- e2fsprogs-1.39-RHEL5.orig/e2fsck/swapfs.c -+++ e2fsprogs-1.39-RHEL5/e2fsck/swapfs.c -@@ -113,7 +113,7 @@ static void swap_inodes(e2fsck_t ctx) - dgrp_t group; - unsigned int i; - ext2_ino_t ino = 1; -- char *buf, *block_buf; -+ char *buf = NULL, *block_buf = NULL; - errcode_t retval; - struct ext2_inode * inode; - -@@ -125,7 +125,7 @@ static void swap_inodes(e2fsck_t ctx) - com_err("swap_inodes", retval, - _("while allocating inode buffer")); - ctx->flags |= E2F_FLAG_ABORT; -- return; -+ goto errout; - } - block_buf = (char *) e2fsck_allocate_memory(ctx, fs->blocksize * 4, - "block interate buffer"); -@@ -138,7 +138,7 @@ static void swap_inodes(e2fsck_t ctx) - _("while reading inode table (group %d)"), - group); - ctx->flags |= E2F_FLAG_ABORT; -- return; -+ goto errout; - } - inode = (struct ext2_inode *) buf; - for (i=0; i < fs->super->s_inodes_per_group; -@@ -163,7 +163,7 @@ static void swap_inodes(e2fsck_t ctx) - swap_inode_blocks(ctx, ino, block_buf, inode); - - if (ctx->flags & E2F_FLAG_SIGNAL_MASK) -- return; -+ goto errout; - - if (fs->flags & EXT2_FLAG_SWAP_BYTES_WRITE) - ext2fs_swap_inode(fs, inode, inode, 1); -@@ -176,11 +176,14 @@ static void swap_inodes(e2fsck_t ctx) - _("while writing inode table (group %d)"), - group); - ctx->flags |= E2F_FLAG_ABORT; -- return; -+ goto errout; - } - } -- ext2fs_free_mem(&buf); -- ext2fs_free_mem(&block_buf); -+errout: -+ if (buf) -+ ext2fs_free_mem(&buf); -+ if (block_buf) -+ ext2fs_free_mem(&block_buf); - e2fsck_use_inode_shortcuts(ctx, 0); - ext2fs_flush_icache(fs); - } - -# HG changeset patch -# User tytso@mit.edu -# Date 1175100185 14400 -# Node ID 8d2467f79e369a2ad8fcdbc9d11c816e3ad68e20 -# Parent 41169d959e94ac9713a7c781a8a195e73a06b1ff -[COVERITY] Fix (error case only) memory leak in e2fsck pass #4 - -Coverity ID: 42: Resource Leak - -Signed-off-by: Brian Behlendorf - -Index: e2fsprogs-1.39-RHEL5/e2fsck/ChangeLog -=================================================================== ---- e2fsprogs-1.39-RHEL5.orig/e2fsck/ChangeLog -+++ e2fsprogs-1.39-RHEL5/e2fsck/ChangeLog -@@ -2,7 +2,7 @@ - - * pass1.c (e2fsck_pass1, check_ext_attr), - pass5.c (check_block_bitmaps, check_inode_bitmaps), -- swapfs.c (swap_inodes), -+ pass4.c (e2fsck_pass4), swapfs.c (swap_inodes), - unix.c (parse_extended_opts): Fix memory leaks - - 2007-03-21 Theodore Tso -Index: e2fsprogs-1.39-RHEL5/e2fsck/pass4.c -=================================================================== ---- e2fsprogs-1.39-RHEL5.orig/e2fsck/pass4.c -+++ e2fsprogs-1.39-RHEL5/e2fsck/pass4.c -@@ -114,12 +114,12 @@ void e2fsck_pass4(e2fsck_t ctx) - /* Protect loop from wrap-around if s_inodes_count maxed */ - for (i=1; i <= fs->super->s_inodes_count && i > 0; i++) { - if (ctx->flags & E2F_FLAG_SIGNAL_MASK) -- return; -+ goto errout; - if ((i % fs->super->s_inodes_per_group) == 0) { - group++; - if (ctx->progress) - if ((ctx->progress)(ctx, 4, group, maxgroup)) -- return; -+ goto errout; - } - if (i == EXT2_BAD_INO || - (i > EXT2_ROOT_INO && i < EXT2_FIRST_INODE(fs->super))) -@@ -167,6 +167,7 @@ void e2fsck_pass4(e2fsck_t ctx) - ctx->inode_bb_map = 0; - ext2fs_free_inode_bitmap(ctx->inode_imagic_map); - ctx->inode_imagic_map = 0; -+errout: - if (buf) - ext2fs_free_mem(&buf); - #ifdef RESOURCE_TRACK - -# HG changeset patch -# User tytso@mit.edu -# Date 1175141957 14400 -# Node ID 3fe5a1e5c3a4f7e4158f7e13c8e8fad0355fa473 -# Parent 8d2467f79e369a2ad8fcdbc9d11c816e3ad68e20 -[COVERITY] Fix (error case only) memory leak in e2fsck_get_journal - -Coverity ID: 43: Resource Leak - -Signed-off-by: Brian Behlendorf - -Index: e2fsprogs-1.39-RHEL5/e2fsck/ChangeLog -=================================================================== ---- e2fsprogs-1.39-RHEL5.orig/e2fsck/ChangeLog -+++ e2fsprogs-1.39-RHEL5/e2fsck/ChangeLog -@@ -3,6 +3,7 @@ - * pass1.c (e2fsck_pass1, check_ext_attr), - pass5.c (check_block_bitmaps, check_inode_bitmaps), - pass4.c (e2fsck_pass4), swapfs.c (swap_inodes), -+ journal.c (e2fsck_get_journal), - unix.c (parse_extended_opts): Fix memory leaks - - 2007-03-21 Theodore Tso -Index: e2fsprogs-1.39-RHEL5/e2fsck/journal.c -=================================================================== ---- e2fsprogs-1.39-RHEL5.orig/e2fsck/journal.c -+++ e2fsprogs-1.39-RHEL5/e2fsck/journal.c -@@ -206,9 +206,9 @@ static errcode_t e2fsck_get_journal(e2fs - int ext_journal = 0; - int tried_backup_jnl = 0; - int i; -- -+ - clear_problem_context(&pctx); -- -+ - journal = e2fsck_allocate_memory(ctx, sizeof(journal_t), "journal"); - if (!journal) { - return EXT2_ET_NO_MEMORY; -@@ -220,19 +220,21 @@ static errcode_t e2fsck_get_journal(e2fs - goto errout; - } - dev_journal = dev_fs+1; -- -+ - dev_fs->k_ctx = dev_journal->k_ctx = ctx; - dev_fs->k_dev = K_DEV_FS; - dev_journal->k_dev = K_DEV_JOURNAL; -- -+ - journal->j_dev = dev_journal; - journal->j_fs_dev = dev_fs; - journal->j_inode = NULL; - journal->j_blocksize = ctx->fs->blocksize; - - if (uuid_is_null(sb->s_journal_uuid)) { -- if (!sb->s_journal_inum) -- return EXT2_ET_BAD_INODE_NUM; -+ if (!sb->s_journal_inum) { -+ retval = EXT2_ET_BAD_INODE_NUM; -+ goto errout; -+ } - j_inode = e2fsck_allocate_memory(ctx, sizeof(*j_inode), - "journal inode"); - if (!j_inode) { -@@ -242,7 +244,7 @@ static errcode_t e2fsck_get_journal(e2fs - - j_inode->i_ctx = ctx; - j_inode->i_ino = sb->s_journal_inum; -- -+ - if ((retval = ext2fs_read_inode(ctx->fs, - sb->s_journal_inum, - &j_inode->i_ext2))) { -@@ -311,12 +313,13 @@ static errcode_t e2fsck_get_journal(e2fs - ctx->journal_name = blkid_devno_to_devname(sb->s_journal_dev); - } - journal_name = ctx->journal_name; -- -+ - if (!journal_name) { - fix_problem(ctx, PR_0_CANT_FIND_JOURNAL, &pctx); -- return EXT2_ET_LOAD_EXT_JOURNAL; -+ retval = EXT2_ET_LOAD_EXT_JOURNAL; -+ goto errout; - } -- -+ - jfs_debug(1, "Using journal file %s\n", journal_name); - io_ptr = unix_io_manager; - } -@@ -368,7 +371,7 @@ static errcode_t e2fsck_get_journal(e2fs - retval = EXT2_ET_LOAD_EXT_JOURNAL; - goto errout; - } -- -+ - journal->j_maxlen = jsuper.s_blocks_count; - start++; - } -@@ -377,10 +380,10 @@ static errcode_t e2fsck_get_journal(e2fs - retval = EXT2_ET_NO_MEMORY; - goto errout; - } -- -+ - journal->j_sb_buffer = bh; - journal->j_superblock = (journal_superblock_t *)bh->b_data; -- -+ - #ifdef USE_INODE_IO - if (j_inode) - ext2fs_free_mem(&j_inode); -@@ -397,7 +400,6 @@ errout: - if (journal) - ext2fs_free_mem(&journal); - return retval; -- - } - - static errcode_t e2fsck_journal_fix_bad_inode(e2fsck_t ctx, - -# HG changeset patch -# User tytso@mit.edu -# Date 1175142370 14400 -# Node ID 83742c60d8d8d5c9f4b9d6819a543adabe207352 -# Parent 3fe5a1e5c3a4f7e4158f7e13c8e8fad0355fa473 -[COVERITY] Fix coverity warning in debugfs - -This is a no-op since long_opt isn't currently being used; the -l option -to htree_dump is currently unwired to anything at the moment. - -Signed-off-by: Brian Behlendorf - -Coverity ID: 47: Used before assigned - -Index: e2fsprogs-1.39-RHEL5/debugfs/ChangeLog -=================================================================== ---- e2fsprogs-1.39-RHEL5.orig/debugfs/ChangeLog -+++ e2fsprogs-1.39-RHEL5/debugfs/ChangeLog -@@ -1,3 +1,9 @@ -+2007-03-29 Theodore Tso -+ -+ * htree.c (do_htree_dump): Fix coverity use before assignment -+ warning. (long_opt isn't being used for anything right -+ now, so this is a no-op) -+ - 2007-03-23 Theodore Tso - - * logdump.c (do_logdump): Fix file handle leak if logdump fails -Index: e2fsprogs-1.39-RHEL5/debugfs/htree.c -=================================================================== ---- e2fsprogs-1.39-RHEL5.orig/debugfs/htree.c -+++ e2fsprogs-1.39-RHEL5/debugfs/htree.c -@@ -180,7 +180,7 @@ void do_htree_dump(int argc, char *argv[ - ext2_ino_t ino; - struct ext2_inode inode; - int c; -- int long_opt; -+ int long_opt = 0; - char *buf = NULL; - struct ext2_dx_root_info *rootnode; - struct ext2_dx_entry *ent; - -# HG changeset patch -# User tytso@mit.edu -# Date 1175142743 14400 -# Node ID 11d3e029aa835208505e6f03689a4879fb669c3d -# Parent 83742c60d8d8d5c9f4b9d6819a543adabe207352 -[COVERITY] Handle potential case in debugfs if ext2fs_get_pathname returns NULL - -Coverity ID: 51: Use After Free - -Signed-off-by: Brian Behlendorf - -Index: e2fsprogs-1.39-RHEL5/debugfs/ChangeLog -=================================================================== ---- e2fsprogs-1.39-RHEL5.orig/debugfs/ChangeLog -+++ e2fsprogs-1.39-RHEL5/debugfs/ChangeLog -@@ -1,5 +1,8 @@ - 2007-03-29 Theodore Tso - -+ * debugfs.c (do_print_working_directory): Handle the case if -+ ext2fs_get_pathname returns NULL for the pathname. -+ - * htree.c (do_htree_dump): Fix coverity use before assignment - warning. (long_opt isn't being used for anything right - now, so this is a no-op) -Index: e2fsprogs-1.39-RHEL5/debugfs/debugfs.c -=================================================================== ---- e2fsprogs-1.39-RHEL5.orig/debugfs/debugfs.c -+++ e2fsprogs-1.39-RHEL5/debugfs/debugfs.c -@@ -950,15 +950,23 @@ void do_print_working_directory(int argc - com_err(argv[0], retval, - "while trying to get pathname of cwd"); - } -- printf("[pwd] INODE: %6u PATH: %s\n", cwd, pathname); -- free(pathname); -+ printf("[pwd] INODE: %6u PATH: %s\n", -+ cwd, pathname ? pathname : "NULL"); -+ if (pathname) { -+ free(pathname); -+ pathname = NULL; -+ } - retval = ext2fs_get_pathname(current_fs, root, 0, &pathname); - if (retval) { - com_err(argv[0], retval, - "while trying to get pathname of root"); - } -- printf("[root] INODE: %6u PATH: %s\n", root, pathname); -- free(pathname); -+ printf("[root] INODE: %6u PATH: %s\n", -+ root, pathname ? pathname : "NULL"); -+ if (pathname) { -+ free(pathname); -+ pathname = NULL; -+ } - return; - } - diff --git a/e2fsprogs-1.39-dump_unused-segfault.patch b/e2fsprogs-1.39-dump_unused-segfault.patch deleted file mode 100644 index 78a5078..0000000 --- a/e2fsprogs-1.39-dump_unused-segfault.patch +++ /dev/null @@ -1,51 +0,0 @@ -# HG changeset patch -# User tytso@mit.edu -# Date 1170006028 18000 -# Node ID 1619c81226d196f7e943e96b1ecc80c477dc7806 -# Parent 61145b06a34c8a476827e02fd0a8c7c95a2ad912 -Fix dump_usued segault in debugfs if used without open filesystem - -The dump_unused command in debugfs segfaults if used without an open -filesystem: - -sor:~ # debugfs -debugfs 1.39 (29-May-2006) -debugfs: dump_unused -Segmentation fault - -Patch (from IBM) below. - -Signed-off-by: Matthias Koenig - - -Index: e2fsprogs-1.39-RHEL5/debugfs/ChangeLog -=================================================================== ---- e2fsprogs-1.39-RHEL5.orig/debugfs/ChangeLog -+++ e2fsprogs-1.39-RHEL5/debugfs/ChangeLog -@@ -24,6 +24,11 @@ - to avoid the possibility of an array overrun if the - filename is exactly EXT2_NAME_LEN in size. - -+2007-01-28 Theodore Tso -+ -+ * unused.c: Fix bug so that the dump_unused command segfault if -+ used without an open filesystem -+ - 2006-08-30 Eric Sandeen - - * htree.c (htree_dump_int_node): Fix printf formats. -Index: e2fsprogs-1.39-RHEL5/debugfs/unused.c -=================================================================== ---- e2fsprogs-1.39-RHEL5.orig/debugfs/unused.c -+++ e2fsprogs-1.39-RHEL5/debugfs/unused.c -@@ -31,6 +31,10 @@ void do_dump_unused(int argc EXT2FS_ATTR - unsigned int i; - errcode_t retval; - -+ if (common_args_process(argc, argv, 1, 1, -+ "dump_unused", "", 0)) -+ return; -+ - for (blk=current_fs->super->s_first_data_block; - blk < current_fs->super->s_blocks_count; blk++) { - if (ext2fs_test_block_bitmap(current_fs->block_map,blk)) diff --git a/e2fsprogs-1.39-e2p_percent.patch b/e2fsprogs-1.39-e2p_percent.patch deleted file mode 100644 index 54ea455..0000000 --- a/e2fsprogs-1.39-e2p_percent.patch +++ /dev/null @@ -1,216 +0,0 @@ -# HG changeset patch -# User tytso@mit.edu -# Date Wed Aug 30 03:08:13 2006 -0400 -# Node ID 4a2b0d6c55fc3bea9e5bed4faa82845676f3be2b -# parent: 14e45223b10be14cc318f10b804a3fd535a86ad5 -Fix potential 2**32-1 overflow by using e2p_percent() - -Add a new functiom, e2p_percent(), which correct calculates the percentage -of a number based on a given percentage, without worrying about overflow -issues. This is used where we calculate the number of reserved blocks using -a percentage of the total number of blocks in a filesystem. - -Based on patches from Eric Sandeen, but generalized to use this new function. - -Signed-off-by: "Theodore Ts'o" -Signed-off-by: Eric Sandeen - -Index: e2fsprogs-1.39-my-patches-from-ted/lib/e2p/ChangeLog -=================================================================== ---- e2fsprogs-1.39-my-patches-from-ted.orig/lib/e2p/ChangeLog -+++ e2fsprogs-1.39-my-patches-from-ted/lib/e2p/ChangeLog -@@ -1,3 +1,9 @@ -+2006-08-30 Theodore Tso -+ -+ * percent.c (e2p_percent): Add a new function which accurate and -+ without risk of overflow calculates a percentage of a base -+ number. -+ - 2006-05-08 Theodore Tso - - * feature.c: Add support for EXT2_FEATURE_COMPAT_LAZY_BG feature. -Index: e2fsprogs-1.39-my-patches-from-ted/lib/e2p/Makefile.in -=================================================================== ---- e2fsprogs-1.39-my-patches-from-ted.orig/lib/e2p/Makefile.in -+++ e2fsprogs-1.39-my-patches-from-ted/lib/e2p/Makefile.in -@@ -19,7 +19,7 @@ all:: e2p.pc - OBJS= feature.o fgetflags.o fsetflags.o fgetversion.o fsetversion.o \ - getflags.o getversion.o hashstr.o iod.o ls.o mntopts.o \ - parse_num.o pe.o pf.o ps.o setflags.o setversion.o uuid.o \ -- ostype.o -+ ostype.o percent.o - - SRCS= $(srcdir)/feature.c $(srcdir)/fgetflags.c \ - $(srcdir)/fsetflags.c $(srcdir)/fgetversion.c \ -@@ -28,7 +28,7 @@ SRCS= $(srcdir)/feature.c $(srcdir)/fge - $(srcdir)/ls.c $(srcdir)/mntopts.c $(srcdir)/parse_num.c \ - $(srcdir)/pe.c $(srcdir)/pf.c $(srcdir)/ps.c \ - $(srcdir)/setflags.c $(srcdir)/setversion.c $(srcdir)/uuid.c \ -- $(srcdir)/ostype.c -+ $(srcdir)/ostype.c $(srcdir)/percent.o - HFILES= e2p.h - - LIBRARY= libe2p -Index: e2fsprogs-1.39-my-patches-from-ted/lib/e2p/e2p.h -=================================================================== ---- e2fsprogs-1.39-my-patches-from-ted.orig/lib/e2p/e2p.h -+++ e2fsprogs-1.39-my-patches-from-ted/lib/e2p/e2p.h -@@ -50,3 +50,5 @@ unsigned long parse_num_blocks(const cha - - char *e2p_os2string(int os_type); - int e2p_string2os(char *str); -+ -+unsigned int e2p_percent(int percent, unsigned int base); -Index: e2fsprogs-1.39-my-patches-from-ted/misc/ChangeLog -=================================================================== ---- e2fsprogs-1.39-my-patches-from-ted.orig/misc/ChangeLog -+++ e2fsprogs-1.39-my-patches-from-ted/misc/ChangeLog -@@ -1,5 +1,9 @@ - 2006-08-30 Theodore Tso - -+ * tune2fs.c (main), mke2fs.c (PRS): Use e2p_percent to properly -+ calculate the number of reserved blocks without worrying -+ about overflow. -+ - * mke2fs.c (parse_extended_opts): Use ext2fs_div_ceil() instead of - a using an open-coded expression which was subject to - overflows. -Index: e2fsprogs-1.39-my-patches-from-ted/misc/mke2fs.c -=================================================================== ---- e2fsprogs-1.39-my-patches-from-ted.orig/misc/mke2fs.c -+++ e2fsprogs-1.39-my-patches-from-ted/misc/mke2fs.c -@@ -1440,8 +1440,8 @@ static void PRS(int argc, char *argv[]) - /* - * Calculate number of blocks to reserve - */ -- fs_param.s_r_blocks_count = (fs_param.s_blocks_count * reserved_ratio) -- / 100; -+ fs_param.s_r_blocks_count = e2p_percent(reserved_ratio, -+ fs_param.s_blocks_count); - } - - int main (int argc, char *argv[]) -Index: e2fsprogs-1.39-my-patches-from-ted/misc/tune2fs.c -=================================================================== ---- e2fsprogs-1.39-my-patches-from-ted.orig/misc/tune2fs.c -+++ e2fsprogs-1.39-my-patches-from-ted/misc/tune2fs.c -@@ -823,7 +823,8 @@ int main (int argc, char ** argv) - printf (_("Setting interval between checks to %lu seconds\n"), interval); - } - if (m_flag) { -- sb->s_r_blocks_count = sb->s_blocks_count * reserved_ratio /100; -+ sb->s_r_blocks_count = e2p_percent(reserved_ratio, -+ sb->s_blocks_count); - ext2fs_mark_super_dirty(fs); - printf (_("Setting reserved blocks percentage to %g%% (%u blocks)\n"), - reserved_ratio, sb->s_r_blocks_count); -Index: e2fsprogs-1.39-my-patches-from-ted/resize/ChangeLog -=================================================================== ---- e2fsprogs-1.39-my-patches-from-ted.orig/resize/ChangeLog -+++ e2fsprogs-1.39-my-patches-from-ted/resize/ChangeLog -@@ -1,5 +1,9 @@ - 2006-08-30 Theodore Tso - -+ * resize2fs.c (adjust_fs_info), online.c (online_resize_fs): Use -+ e2p_percent to properly calculate the number of reserved -+ blocks without worrying about overflow. -+ - * resize2fs.c (ext2fs_calculate_summary_stats): Fix potential - overflow problems when the number of blocks is close to - 2**31. -Index: e2fsprogs-1.39-my-patches-from-ted/resize/online.c -=================================================================== ---- e2fsprogs-1.39-my-patches-from-ted.orig/resize/online.c -+++ e2fsprogs-1.39-my-patches-from-ted/resize/online.c -@@ -107,7 +107,8 @@ errcode_t online_resize_fs(ext2_filsys f - sb->s_first_data_block - - (i * sb->s_blocks_per_group); - } -- input.reserved_blocks = input.blocks_count * r_frac / 100; -+ input.reserved_blocks = e2p_percent(r_frac, -+ input.blocks_count); - - #if 0 - printf("new block bitmap is at 0x%04x\n", input.block_bitmap); -Index: e2fsprogs-1.39-my-patches-from-ted/resize/resize2fs.c -=================================================================== ---- e2fsprogs-1.39-my-patches-from-ted.orig/resize/resize2fs.c -+++ e2fsprogs-1.39-my-patches-from-ted/resize/resize2fs.c -@@ -245,8 +245,8 @@ retry: - */ - blk = old_fs->super->s_r_blocks_count * 100 / - old_fs->super->s_blocks_count; -- fs->super->s_r_blocks_count = ((fs->super->s_blocks_count * blk) -- / 100); -+ fs->super->s_r_blocks_count = e2p_percent(blk, -+ fs->super->s_blocks_count); - - /* - * Adjust the bitmaps for size -Index: e2fsprogs-1.39-my-patches-from-ted/lib/e2p/percent.c -=================================================================== ---- /dev/null -+++ e2fsprogs-1.39-my-patches-from-ted/lib/e2p/percent.c -@@ -0,0 +1,62 @@ -+/* -+ * percent.c - Take percentage of a number -+ * -+ * Copyright (C) 2006 Theodore Ts'o -+ * -+ * This file can be redistributed under the terms of the GNU Library General -+ * Public License -+ */ -+ -+#include "e2p.h" -+ -+#include -+ -+/* -+ * We work really hard to calculate this accurately, while avoiding -+ * an overflow. "Is there a hyphen in anal-retentive?" :-) -+ */ -+unsigned int e2p_percent(int percent, unsigned int base) -+{ -+ unsigned int mask = ~((1 << (sizeof(unsigned int) - 1) * 8) - 1); -+ -+ if (100 % percent == 0) -+ return base / (100 / percent); -+ if (mask & base) -+ return (base / 100) * percent; -+ return base * percent / 100; -+} -+ -+#ifdef DEBUG -+#include -+#include -+ -+main(int argc, char **argv) -+{ -+ unsigned int base; -+ int percent; -+ char *p; -+ int log_block_size = 0; -+ -+ if (argc != 3) { -+ fprintf(stderr, "Usage: %s percent base\n", argv[0]); -+ exit(1); -+ } -+ -+ percent = strtoul(argv[1], &p, 0); -+ if (p[0] && p[1]) { -+ fprintf(stderr, "Bad percent: %s\n", argv[1]); -+ exit(1); -+ } -+ -+ base = strtoul(argv[2], &p, 0); -+ if (p[0] && p[1]) { -+ fprintf(stderr, "Bad base: %s\n", argv[2]); -+ exit(1); -+ } -+ -+ printf("%d percent of %u is %u.\n", percent, base, -+ e2p_percent(percent, base)); -+ -+ exit(0); -+} -+#endif diff --git a/e2fsprogs-1.39-e2p_percent_div.patch b/e2fsprogs-1.39-e2p_percent_div.patch deleted file mode 100644 index 0c8bd20..0000000 --- a/e2fsprogs-1.39-e2p_percent_div.patch +++ /dev/null @@ -1,132 +0,0 @@ -Return-Path: -Received: from pobox-2.corp.redhat.com ([unix socket]) - by pobox-2.corp.redhat.com (Cyrus v2.2.12-Invoca-RPM-2.2.12-3.RHEL4.1) with LMTPA; - Wed, 20 Sep 2006 05:01:05 -0400 -X-Sieve: CMU Sieve 2.2 -Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) - by pobox-2.corp.redhat.com (8.13.1/8.13.1) with ESMTP id k8K915WI028994 - for ; Wed, 20 Sep 2006 05:01:05 -0400 -Received: from mx3.redhat.com (mx3.redhat.com [172.16.48.32]) - by int-mx1.corp.redhat.com (8.12.11.20060308/8.12.11) with ESMTP id k8K913p5009001; - Wed, 20 Sep 2006 05:01:03 -0400 -Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) - by mx3.redhat.com (8.13.1/8.13.1) with ESMTP id k8K8q7e4029305; - Wed, 20 Sep 2006 05:00:57 -0400 -Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand - id S1750745AbWITI4c (ORCPT + 3 others); - Wed, 20 Sep 2006 04:56:32 -0400 -Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1750747AbWITI4c - (ORCPT ); - Wed, 20 Sep 2006 04:56:32 -0400 -Received: from ecfrec.frec.bull.fr ([129.183.4.8]:62635 "EHLO - ecfrec.frec.bull.fr") by vger.kernel.org with ESMTP - id S1750745AbWITI4a (ORCPT ); - Wed, 20 Sep 2006 04:56:30 -0400 -Received: from localhost (localhost [127.0.0.1]) - by ecfrec.frec.bull.fr (Postfix) with ESMTP id 8B9F219D943 - for ; Wed, 20 Sep 2006 10:56:28 +0200 (CEST) -Received: from ecfrec.frec.bull.fr ([127.0.0.1]) - by localhost (ecfrec.frec.bull.fr [127.0.0.1]) (amavisd-new, port 10024) - with ESMTP id 22796-03 for ; - Wed, 20 Sep 2006 10:56:25 +0200 (CEST) -Received: from ecn002.frec.bull.fr (ecn002.frec.bull.fr [129.183.4.6]) - by ecfrec.frec.bull.fr (Postfix) with ESMTP id 8D8AB19D94C - for ; Wed, 20 Sep 2006 10:56:09 +0200 (CEST) -Received: from openx1.frec.bull.fr ([129.183.10.3]) - by ecn002.frec.bull.fr (Lotus Domino Release 5.0.12) - with ESMTP id 2006092011020109:122246 ; - Wed, 20 Sep 2006 11:02:01 +0200 -Received: by openx1.frec.bull.fr (Postfix, from userid 15348) - id 7751E139B4; Wed, 20 Sep 2006 10:56:08 +0200 (CEST) -Date: Wed, 20 Sep 2006 10:56:08 +0200 -From: Alexandre Ratchov -To: linux-ext4@vger.kernel.org -Cc: Jean-Pierre Dion -Subject: [patch] small fix for e2p_percent() -Message-ID: <20060920085608.GA18351@openx1.frec.bull.fr> -Mime-Version: 1.0 -User-Agent: Mutt/1.4.1i -X-MIMETrack: Itemize by SMTP Server on ECN002/FR/BULL(Release 5.0.12 |February 13, 2003) at - 20/09/2006 11:02:01, - Serialize by Router on ECN002/FR/BULL(Release 5.0.12 |February 13, 2003) at - 20/09/2006 11:02:02, - Serialize complete at 20/09/2006 11:02:02 -Content-Type: text/plain; charset=us-ascii -Content-Disposition: inline -X-Virus-Scanned: by amavisd-new at frec.bull.fr -Sender: linux-ext4-owner@vger.kernel.org -Precedence: bulk -X-Mailing-List: linux-ext4@vger.kernel.org -X-RedHat-Spam-Score: 0 - -hello, - -e2p_percent() doesn't work for zero percent (``mke2fs -m0'' gets killed with -SIGFPE). - -is there a reason for not simply using 64 bit arithmetic? perhaps to avoid -overflows for 7e+9TB file-systems :-), or just for correctness... - -So, here is the patch that fixes this. In order to avoid integer overflows, -we pick 16 more bits to store ``base'' and do the exact division on 48 bits. -Since ``100 * base'' always fits in 48 bits, there's never overflow. This -still work if we remplace 'unsigned int' by 'unsigned long long'. - -cheers, - --- Alexandre - -Signed-off-by: Alexandre Ratchov - -Index: e2fsprogs-1.39-my-patches-from-ted/lib/e2p/percent.c -=================================================================== ---- e2fsprogs-1.39-my-patches-from-ted.orig/lib/e2p/percent.c -+++ e2fsprogs-1.39-my-patches-from-ted/lib/e2p/percent.c -@@ -14,18 +14,41 @@ - /* - * We work really hard to calculate this accurately, while avoiding - * an overflow. "Is there a hyphen in anal-retentive?" :-) -+ * -+ * -- "Yes there is, as in hair-splitting and nit-picking" - */ - unsigned int e2p_percent(int percent, unsigned int base) - { -- unsigned int mask = ~((1 << (sizeof(unsigned int) - 1) * 8) - 1); -+ unsigned hi, lo, q, r; - -- if (100 % percent == 0) -- return base / (100 / percent); -- if (mask & base) -- return (base / 100) * percent; -- return base * percent / 100; -+ /* -+ * in order to avoid overflow we write 'base' as: -+ * -+ * base = hi * 2^16 + lo -+ * -+ * then we do all computations separately on 'hi' and 'lo'. -+ * By using the definition of division: -+ * -+ * precent * base = result * 100 + reminder -+ * -+ * (reminder < 100), we obtain the exact value of 'result' -+ * as follows: -+ */ -+#define BITS 16 -+#define MASK ((1 << BITS) - 1) -+ -+ hi = percent * (base >> BITS); -+ lo = percent * (base & MASK); -+ -+ q = ((hi / 100) << BITS) + lo / 100; -+ r = ((hi % 100) << BITS) + lo % 100; -+ -+ return q + r / 100; -+#undef BITS -+#undef MASK - } - -+ - #ifdef DEBUG - #include - #include diff --git a/e2fsprogs-1.39-ext2fs_div_ceil.patch b/e2fsprogs-1.39-ext2fs_div_ceil.patch deleted file mode 100644 index 93d5241..0000000 --- a/e2fsprogs-1.39-ext2fs_div_ceil.patch +++ /dev/null @@ -1,282 +0,0 @@ -# HG changeset patch -# User tytso@mit.edu -# Date Wed Aug 30 01:57:00 2006 -0400 -# Node ID 59f8a8974d914231642239f176284d92dce0678d -# parent: c76ddbe4519a571de3868c2888d8bb99a559046f -Fix potential 2**32-1 overflow problems by ext2fs_div_ceil() - -Add a new function, ext2fs_div_ceil(), which correctly calculates a division -of two unsigned integer where the result is always rounded up the next -largest integer. This is used everywhere where we might have -previously caused an overflow when the number of blocks -or inodes is too close to 2**32-1. - -Based on patches from Eric Sandeen, but generalized to use this new function - -Signed-off-by: "Theodore Ts'o" -Signed-off-by: Eric Sandeen - -Index: e2fsprogs-1.39-my-patches-from-ted/ext2ed/ChangeLog -=================================================================== ---- e2fsprogs-1.39-my-patches-from-ted.orig/ext2ed/ChangeLog -+++ e2fsprogs-1.39-my-patches-from-ted/ext2ed/ChangeLog -@@ -1,3 +1,8 @@ -+2006-08-30 Theodore Tso -+ -+ * init.c (div_ceil, set_file_system_info): Fix potential overflow -+ for really big filesystems. -+ - 2006-06-30 Theodore Ts'o - - * Release of E2fsprogs 1.38 -Index: e2fsprogs-1.39-my-patches-from-ted/ext2ed/init.c -=================================================================== ---- e2fsprogs-1.39-my-patches-from-ted.orig/ext2ed/init.c -+++ e2fsprogs-1.39-my-patches-from-ted/ext2ed/init.c -@@ -370,6 +370,13 @@ void add_user_command (struct struct_com - ptr->callback [num]=callback; - } - -+static unsigned int div_ceil(unsigned int a, unsigned int b) -+{ -+ if (!a) -+ return 0; -+ return ((a - 1) / b) + 1; -+} -+ - int set_file_system_info (void) - - { -@@ -415,8 +422,8 @@ int set_file_system_info (void) - file_system_info.first_group_desc_offset=2*EXT2_MIN_BLOCK_SIZE; - else - file_system_info.first_group_desc_offset=file_system_info.block_size; -- file_system_info.groups_count=( sb->s_blocks_count-sb->s_first_data_block+sb->s_blocks_per_group-1) / -- sb->s_blocks_per_group; -+ file_system_info.groups_count = div_ceil(sb->s_blocks_count, -+ sb->s_blocks_per_group); - - file_system_info.inodes_per_block=file_system_info.block_size/sizeof (struct ext2_inode); - file_system_info.blocks_per_group=sb->s_inodes_per_group/file_system_info.inodes_per_block; -Index: e2fsprogs-1.39-my-patches-from-ted/lib/ext2fs/ChangeLog -=================================================================== ---- e2fsprogs-1.39-my-patches-from-ted.orig/lib/ext2fs/ChangeLog -+++ e2fsprogs-1.39-my-patches-from-ted/lib/ext2fs/ChangeLog -@@ -1,3 +1,14 @@ -+2006-08-30 Theodore Tso -+ -+ * ext2fs.h (ext2fs_div_ceil): Add new function which safely -+ calculates an integer division where the result is always -+ rounded up while avoiding overflow errors. -+ -+ * initialize.c (calc_reserved_gdt_blocks, ext2fs_initialize): -+ * openfs.c (ext2fs_open2): Use ext2fs_div_ceil() instead of a -+ using an open-coded expression which was subject to -+ overflows. -+ - 2006-05-21 Theodore Tso - - * openfs.c (ext2fs_open2): Fix type warning problem with sizeof() -Index: e2fsprogs-1.39-my-patches-from-ted/lib/ext2fs/ext2fs.h -=================================================================== ---- e2fsprogs-1.39-my-patches-from-ted.orig/lib/ext2fs/ext2fs.h -+++ e2fsprogs-1.39-my-patches-from-ted/lib/ext2fs/ext2fs.h -@@ -969,6 +969,7 @@ extern int ext2fs_group_of_blk(ext2_fils - extern int ext2fs_group_of_ino(ext2_filsys fs, ext2_ino_t ino); - extern blk_t ext2fs_inode_data_blocks(ext2_filsys fs, - struct ext2_inode *inode); -+extern unsigned int ext2fs_div_ceil(unsigned int a, unsigned int b); - - /* - * The actual inlined functions definitions themselves... -@@ -1136,6 +1137,16 @@ _INLINE_ blk_t ext2fs_inode_data_blocks( - return inode->i_blocks - - (inode->i_file_acl ? fs->blocksize >> 9 : 0); - } -+ -+/* -+ * This is an efficient, overflow safe way of calculating ceil((1.0 * a) / b) -+ */ -+_INLINE_ unsigned int ext2fs_div_ceil(unsigned int a, unsigned int b) -+{ -+ if (!a) -+ return 0; -+ return ((a - 1) / b) + 1; -+} - #undef _INLINE_ - #endif - -Index: e2fsprogs-1.39-my-patches-from-ted/lib/ext2fs/initialize.c -=================================================================== ---- e2fsprogs-1.39-my-patches-from-ted.orig/lib/ext2fs/initialize.c -+++ e2fsprogs-1.39-my-patches-from-ted/lib/ext2fs/initialize.c -@@ -77,8 +77,8 @@ static unsigned int calc_reserved_gdt_bl - */ - if (sb->s_blocks_count < max_blocks / 1024) - max_blocks = sb->s_blocks_count * 1024; -- rsv_groups = (max_blocks - sb->s_first_data_block + bpg - 1) / bpg; -- rsv_gdb = (rsv_groups + gdpb - 1) / gdpb - fs->desc_blocks; -+ rsv_groups = ext2fs_div_ceil(max_blocks - sb->s_first_data_block, bpg); -+ rsv_gdb = ext2fs_div_ceil(rsv_groups, gdpb) - fs->desc_blocks; - if (rsv_gdb > EXT2_ADDR_PER_BLOCK(sb)) - rsv_gdb = EXT2_ADDR_PER_BLOCK(sb); - #ifdef RES_GDT_DEBUG -@@ -205,17 +205,15 @@ errcode_t ext2fs_initialize(const char * - } - - retry: -- fs->group_desc_count = (super->s_blocks_count - -- super->s_first_data_block + -- EXT2_BLOCKS_PER_GROUP(super) - 1) -- / EXT2_BLOCKS_PER_GROUP(super); -+ fs->group_desc_count = ext2fs_div_ceil(super->s_blocks_count - -+ super->s_first_data_block, -+ EXT2_BLOCKS_PER_GROUP(super)); - if (fs->group_desc_count == 0) { - retval = EXT2_ET_TOOSMALL; - goto cleanup; - } -- fs->desc_blocks = (fs->group_desc_count + -- EXT2_DESC_PER_BLOCK(super) - 1) -- / EXT2_DESC_PER_BLOCK(super); -+ fs->desc_blocks = ext2fs_div_ceil(fs->group_desc_count, -+ EXT2_DESC_PER_BLOCK(super)); - - i = fs->blocksize >= 4096 ? 1 : 4096 / fs->blocksize; - set_field(s_inodes_count, super->s_blocks_count / i); -@@ -233,8 +231,7 @@ retry: - * should be. But make sure that we don't allocate more than - * one bitmap's worth of inodes each group. - */ -- ipg = (super->s_inodes_count + fs->group_desc_count - 1) / -- fs->group_desc_count; -+ ipg = ext2fs_div_ceil(super->s_inodes_count, fs->group_desc_count); - if (ipg > fs->blocksize * 8) { - if (super->s_blocks_per_group >= 256) { - /* Try again with slightly different parameters */ -Index: e2fsprogs-1.39-my-patches-from-ted/lib/ext2fs/openfs.c -=================================================================== ---- e2fsprogs-1.39-my-patches-from-ted.orig/lib/ext2fs/openfs.c -+++ e2fsprogs-1.39-my-patches-from-ted/lib/ext2fs/openfs.c -@@ -258,12 +258,11 @@ errcode_t ext2fs_open2(const char *name, - retval = EXT2_ET_CORRUPT_SUPERBLOCK; - goto cleanup; - } -- fs->group_desc_count = (fs->super->s_blocks_count - -- fs->super->s_first_data_block + -- blocks_per_group - 1) / blocks_per_group; -- fs->desc_blocks = (fs->group_desc_count + -- EXT2_DESC_PER_BLOCK(fs->super) - 1) -- / EXT2_DESC_PER_BLOCK(fs->super); -+ fs->group_desc_count = ext2fs_div_ceil(fs->super->s_blocks_count - -+ fs->super->s_first_data_block, -+ blocks_per_group); -+ fs->desc_blocks = ext2fs_div_ceil(fs->group_desc_count, -+ EXT2_DESC_PER_BLOCK(fs->super)); - retval = ext2fs_get_mem(fs->desc_blocks * fs->blocksize, - &fs->group_desc); - if (retval) -Index: e2fsprogs-1.39-my-patches-from-ted/misc/ChangeLog -=================================================================== ---- e2fsprogs-1.39-my-patches-from-ted.orig/misc/ChangeLog -+++ e2fsprogs-1.39-my-patches-from-ted/misc/ChangeLog -@@ -1,3 +1,12 @@ -+2006-08-30 Theodore Tso -+ -+ * mke2fs.c (parse_extended_opts): Use ext2fs_div_ceil() instead of -+ a using an open-coded expression which was subject to -+ overflows. -+ -+ * filefrag.c (div_ceil, frag_report): Fix potential overflow for -+ really big filesystems. -+ - 2006-05-29 Theodore Tso - - * filefrag.c: Add support for ancient Linux systems that do not -Index: e2fsprogs-1.39-my-patches-from-ted/misc/filefrag.c -=================================================================== ---- e2fsprogs-1.39-my-patches-from-ted.orig/misc/filefrag.c -+++ e2fsprogs-1.39-my-patches-from-ted/misc/filefrag.c -@@ -47,6 +47,13 @@ int verbose = 0; - #define EXT3_EXTENTS_FL 0x00080000 /* Inode uses extents */ - #define EXT3_IOC_GETFLAGS _IOR('f', 1, long) - -+static unsigned int div_ceil(unsigned int a, unsigned int b) -+{ -+ if (!a) -+ return 0; -+ return ((a - 1) / b) + 1; -+} -+ - static unsigned long get_bmap(int fd, unsigned long block) - { - int ret; -@@ -105,7 +112,7 @@ static void frag_report(const char *file - if (verbose) { - printf("Filesystem type is: %x\n", fsinfo.f_type); - } -- cylgroups = (fsinfo.f_blocks + fsinfo.f_bsize*8-1) / fsinfo.f_bsize*8; -+ cylgroups = div_ceil(fsinfo.f_blocks, fsinfo.f_bsize*8); - if (verbose) { - printf("Filesystem cylinder groups is approximately %ld\n", - cylgroups); -Index: e2fsprogs-1.39-my-patches-from-ted/misc/mke2fs.c -=================================================================== ---- e2fsprogs-1.39-my-patches-from-ted.orig/misc/mke2fs.c -+++ e2fsprogs-1.39-my-patches-from-ted/misc/mke2fs.c -@@ -819,12 +819,12 @@ static void parse_extended_opts(struct e - if (!bpg) - bpg = blocksize * 8; - gdpb = blocksize / sizeof(struct ext2_group_desc); -- group_desc_count = (param->s_blocks_count + -- bpg - 1) / bpg; -+ group_desc_count = -+ ext2fs_div_ceil(param->s_blocks_count, bpg); - desc_blocks = (group_desc_count + - gdpb - 1) / gdpb; -- rsv_groups = (resize + bpg - 1) / bpg; -- rsv_gdb = (rsv_groups + gdpb - 1) / gdpb - -+ rsv_groups = ext2fs_div_ceil(resize, bpg); -+ rsv_gdb = ext2fs_div_ceil(rsv_groups, gdpb) - - desc_blocks; - if (rsv_gdb > (int) EXT2_ADDR_PER_BLOCK(param)) - rsv_gdb = EXT2_ADDR_PER_BLOCK(param); -Index: e2fsprogs-1.39-my-patches-from-ted/resize/ChangeLog -=================================================================== ---- e2fsprogs-1.39-my-patches-from-ted.orig/resize/ChangeLog -+++ e2fsprogs-1.39-my-patches-from-ted/resize/ChangeLog -@@ -1,3 +1,9 @@ -+2006-08-30 Theodore Tso -+ -+ * resize2fs.c (adjust_fs_info): Use ext2fs_div_ceil() instead of a -+ using an open-coded expression which was subject to -+ overflows. -+ - 2006-05-22 Theodore Tso - - * resize2fs.8.in: Fixed spelling mistake (Addresses Debian Bug: -Index: e2fsprogs-1.39-my-patches-from-ted/resize/resize2fs.c -=================================================================== ---- e2fsprogs-1.39-my-patches-from-ted.orig/resize/resize2fs.c -+++ e2fsprogs-1.39-my-patches-from-ted/resize/resize2fs.c -@@ -190,15 +190,13 @@ errcode_t adjust_fs_info(ext2_filsys fs, - fs->super->s_blocks_count = new_size; - - retry: -- fs->group_desc_count = (fs->super->s_blocks_count - -- fs->super->s_first_data_block + -- EXT2_BLOCKS_PER_GROUP(fs->super) - 1) -- / EXT2_BLOCKS_PER_GROUP(fs->super); -+ fs->group_desc_count = ext2fs_div_ceil(fs->super->s_blocks_count - -+ fs->super->s_first_data_block, -+ EXT2_BLOCKS_PER_GROUP(fs->super)); - if (fs->group_desc_count == 0) - return EXT2_ET_TOOSMALL; -- fs->desc_blocks = (fs->group_desc_count + -- EXT2_DESC_PER_BLOCK(fs->super) - 1) -- / EXT2_DESC_PER_BLOCK(fs->super); -+ fs->desc_blocks = ext2fs_div_ceil(fs->group_desc_count, -+ EXT2_DESC_PER_BLOCK(fs->super)); - - /* - * Overhead is the number of bookkeeping blocks per group. It diff --git a/e2fsprogs-1.39-fix-loop-wraps.patch b/e2fsprogs-1.39-fix-loop-wraps.patch deleted file mode 100644 index 4d4f2b9..0000000 --- a/e2fsprogs-1.39-fix-loop-wraps.patch +++ /dev/null @@ -1,151 +0,0 @@ -# HG changeset patch -# User tytso@mit.edu -# Date Wed Aug 30 02:16:55 2006 -0400 -# Node ID 14e45223b10be14cc318f10b804a3fd535a86ad5 -# parent: d609388faa895de79ff143e53f8ed04557048c42 -Detect overflows in loop counters - -For loops such as: - -for (i=1; i <= fs->super->s_blocks_count; i++) { - -} - -if i is an int and s_blocks_count is (2^32-1), the condition is never false. -Change these loops to: - -for (i=1; i <= fs->super->s_blocks_count && i > 0; i++) { - -} - -to stop the loop when we overflow i - -Signed-off-by: Eric Sandeen -Signed-off-by: "Theodore Ts'o" - -Index: e2fsprogs-1.39-my-patches-from-ted/e2fsck/ChangeLog -=================================================================== ---- e2fsprogs-1.39-my-patches-from-ted.orig/e2fsck/ChangeLog -+++ e2fsprogs-1.39-my-patches-from-ted/e2fsck/ChangeLog -@@ -1,3 +1,9 @@ -+2006-08-30 Theodore Tso -+ -+ * pass5.c (check_inode_bitmaps, check_inode_end, check_block_end): -+ * pass4.c (e2fsck_pass4): Fix potential overflow problems when the -+ number of blocks is close to 2**31. -+ - 2006-05-29 Theodore Tso - - * pass1b.c: Add missing semicolon when HAVE_INTPTR_T is not defined -Index: e2fsprogs-1.39-my-patches-from-ted/e2fsck/pass4.c -=================================================================== ---- e2fsprogs-1.39-my-patches-from-ted.orig/e2fsck/pass4.c -+++ e2fsprogs-1.39-my-patches-from-ted/e2fsck/pass4.c -@@ -110,8 +110,9 @@ void e2fsck_pass4(e2fsck_t ctx) - if (ctx->progress) - if ((ctx->progress)(ctx, 4, 0, maxgroup)) - return; -- -- for (i=1; i <= fs->super->s_inodes_count; i++) { -+ -+ /* Protect loop from wrap-around if s_inodes_count maxed */ -+ for (i=1; i <= fs->super->s_inodes_count && i > 0; i++) { - if (ctx->flags & E2F_FLAG_SIGNAL_MASK) - return; - if ((i % fs->super->s_inodes_per_group) == 0) { -Index: e2fsprogs-1.39-my-patches-from-ted/e2fsck/pass5.c -=================================================================== ---- e2fsprogs-1.39-my-patches-from-ted.orig/e2fsck/pass5.c -+++ e2fsprogs-1.39-my-patches-from-ted/e2fsck/pass5.c -@@ -370,7 +370,8 @@ redo_counts: - EXT2_BG_INODE_UNINIT)) - skip_group++; - -- for (i = 1; i <= fs->super->s_inodes_count; i++) { -+ /* Protect loop from wrap-around if inodes_count is maxed */ -+ for (i = 1; i <= fs->super->s_inodes_count && i > 0; i++) { - actual = ext2fs_fast_test_inode_bitmap(ctx->inode_used_map, i); - if (skip_group) - bitmap = 0; -@@ -528,8 +529,9 @@ static void check_inode_end(e2fsck_t ctx - } - if (save_inodes_count == end) - return; -- -- for (i = save_inodes_count + 1; i <= end; i++) { -+ -+ /* protect loop from wrap-around if end is maxed */ -+ for (i = save_inodes_count + 1; i <= end && i > save_inodes_count; i++) { - if (!ext2fs_test_inode_bitmap(fs->inode_map, i)) { - if (fix_problem(ctx, PR_5_INODE_BMAP_PADDING, &pctx)) { - for (i = save_inodes_count + 1; i <= end; i++) -@@ -572,8 +574,9 @@ static void check_block_end(e2fsck_t ctx - } - if (save_blocks_count == end) - return; -- -- for (i = save_blocks_count + 1; i <= end; i++) { -+ -+ /* Protect loop from wrap-around if end is maxed */ -+ for (i = save_blocks_count + 1; i <= end && i > save_blocks_count; i++) { - if (!ext2fs_test_block_bitmap(fs->block_map, i)) { - if (fix_problem(ctx, PR_5_BLOCK_BMAP_PADDING, &pctx)) { - for (i = save_blocks_count + 1; i <= end; i++) -Index: e2fsprogs-1.39-my-patches-from-ted/lib/ext2fs/ChangeLog -=================================================================== ---- e2fsprogs-1.39-my-patches-from-ted.orig/lib/ext2fs/ChangeLog -+++ e2fsprogs-1.39-my-patches-from-ted/lib/ext2fs/ChangeLog -@@ -1,5 +1,8 @@ - 2006-08-30 Theodore Tso - -+ * bitmaps.c (ext2fs_set_bitmap_padding): Fix potential overflow -+ problems when the number of blocks is close to 2**31. -+ - * ext2fs.h (ext2fs_div_ceil): Add new function which safely - calculates an integer division where the result is always - rounded up while avoiding overflow errors. -Index: e2fsprogs-1.39-my-patches-from-ted/lib/ext2fs/bitmaps.c -=================================================================== ---- e2fsprogs-1.39-my-patches-from-ted.orig/lib/ext2fs/bitmaps.c -+++ e2fsprogs-1.39-my-patches-from-ted/lib/ext2fs/bitmaps.c -@@ -102,7 +102,10 @@ void ext2fs_set_bitmap_padding(ext2fs_ge - { - __u32 i, j; - -- for (i=map->end+1, j = i - map->start; i <= map->real_end; i++, j++) -+ /* Protect loop from wrap-around if map->real_end is maxed */ -+ for (i=map->end+1, j = i - map->start; -+ i <= map->real_end && i > map->end; -+ i++, j++) - ext2fs_set_bit(j, map->bitmap); - - return; -Index: e2fsprogs-1.39-my-patches-from-ted/resize/ChangeLog -=================================================================== ---- e2fsprogs-1.39-my-patches-from-ted.orig/resize/ChangeLog -+++ e2fsprogs-1.39-my-patches-from-ted/resize/ChangeLog -@@ -1,5 +1,9 @@ - 2006-08-30 Theodore Tso - -+ * resize2fs.c (ext2fs_calculate_summary_stats): Fix potential -+ overflow problems when the number of blocks is close to -+ 2**31. -+ - * resize2fs.c (adjust_fs_info): Use ext2fs_div_ceil() instead of a - using an open-coded expression which was subject to - overflows. -Index: e2fsprogs-1.39-my-patches-from-ted/resize/resize2fs.c -=================================================================== ---- e2fsprogs-1.39-my-patches-from-ted.orig/resize/resize2fs.c -+++ e2fsprogs-1.39-my-patches-from-ted/resize/resize2fs.c -@@ -1582,7 +1582,9 @@ static errcode_t ext2fs_calculate_summar - total_free = 0; - count = 0; - group = 0; -- for (ino = 1; ino <= fs->super->s_inodes_count; ino++) { -+ -+ /* Protect loop from wrap-around if s_inodes_count maxed */ -+ for (ino = 1; ino <= fs->super->s_inodes_count && ino > 0; ino++) { - if (!ext2fs_fast_test_inode_bitmap(fs->inode_map, ino)) { - group_free++; - total_free++; diff --git a/e2fsprogs-1.39-fix_formats.patch b/e2fsprogs-1.39-fix_formats.patch deleted file mode 100644 index b2112f8..0000000 --- a/e2fsprogs-1.39-fix_formats.patch +++ /dev/null @@ -1,552 +0,0 @@ -# HG changeset patch -# User tytso@mit.edu -# Date Tue Sep 12 14:56:15 2006 -0400 -# Node ID 4b504bc7413f5ef17f8b62f4b3479da6bfa83efb -# parent: 59bf36fb8344bb7a3971af7df22d41f8d8b14610 -Fix signed vs unsigned printf format strings for block and inode numbers - -There were still some %d's lurking when we print blocks & inodes; also -many of the counters in the e2fsck_struct were signed, and probably -need to be unsigned to avoid overflows. - -Signed-off-by: Eric Sandeen - -Index: e2fsprogs-1.39-my-patches-from-ted/debugfs/ChangeLog -=================================================================== ---- e2fsprogs-1.39-my-patches-from-ted.orig/debugfs/ChangeLog -+++ e2fsprogs-1.39-my-patches-from-ted/debugfs/ChangeLog -@@ -1,3 +1,7 @@ -+2006-08-30 Eric Sandeen -+ -+ * htree.c (htree_dump_int_node): Fix printf formats. -+ - 2006-05-29 Theodore Tso - - * util.c (reset_getopt): In order to support ancient Linux header -Index: e2fsprogs-1.39-my-patches-from-ted/debugfs/htree.c -=================================================================== ---- e2fsprogs-1.39-my-patches-from-ted.orig/debugfs/htree.c -+++ e2fsprogs-1.39-my-patches-from-ted/debugfs/htree.c -@@ -114,7 +114,7 @@ static void htree_dump_int_node(ext2_fil - - for (i=0; i < limit.count; i++) { - hash = i ? ext2fs_le32_to_cpu(ent[i].hash) : 0; -- fprintf(pager, "Entry #%d: Hash 0x%08x%s, block %d\n", i, -+ fprintf(pager, "Entry #%d: Hash 0x%08x%s, block %u\n", i, - hash, (hash & 1) ? " (**)" : "", - ext2fs_le32_to_cpu(ent[i].block)); - } -Index: e2fsprogs-1.39-my-patches-from-ted/e2fsck/ChangeLog -=================================================================== ---- e2fsprogs-1.39-my-patches-from-ted.orig/e2fsck/ChangeLog -+++ e2fsprogs-1.39-my-patches-from-ted/e2fsck/ChangeLog -@@ -1,5 +1,12 @@ - 2006-08-30 Eric Sandeen - -+ * e2fsck.h (e2fsck): Use unsigned types for filesystem counters. -+ * emptydir.c (add_empty_dirblock): -+ * iscan.c (main): -+ * unix.c (show_stats, check_if_skip): Fix printf formats. -+ -+2006-08-30 Eric Sandeen -+ - * pass1.c (handle_fs_bad_blocks): Remove unused variables. - - 2006-08-30 Eric Sandeen -Index: e2fsprogs-1.39-my-patches-from-ted/e2fsck/e2fsck.h -=================================================================== ---- e2fsprogs-1.39-my-patches-from-ted.orig/e2fsck/e2fsck.h -+++ e2fsprogs-1.39-my-patches-from-ted/e2fsck/e2fsck.h -@@ -306,24 +306,24 @@ struct e2fsck_struct { - char start_meta[2], stop_meta[2]; - - /* File counts */ -- int fs_directory_count; -- int fs_regular_count; -- int fs_blockdev_count; -- int fs_chardev_count; -- int fs_links_count; -- int fs_symlinks_count; -- int fs_fast_symlinks_count; -- int fs_fifo_count; -- int fs_total_count; -- int fs_badblocks_count; -- int fs_sockets_count; -- int fs_ind_count; -- int fs_dind_count; -- int fs_tind_count; -- int fs_fragmented; -- int large_files; -- int fs_ext_attr_inodes; -- int fs_ext_attr_blocks; -+ __u32 fs_directory_count; -+ __u32 fs_regular_count; -+ __u32 fs_blockdev_count; -+ __u32 fs_chardev_count; -+ __u32 fs_links_count; -+ __u32 fs_symlinks_count; -+ __u32 fs_fast_symlinks_count; -+ __u32 fs_fifo_count; -+ __u32 fs_total_count; -+ __u32 fs_badblocks_count; -+ __u32 fs_sockets_count; -+ __u32 fs_ind_count; -+ __u32 fs_dind_count; -+ __u32 fs_tind_count; -+ __u32 fs_fragmented; -+ __u32 large_files; -+ __u32 fs_ext_attr_inodes; -+ __u32 fs_ext_attr_blocks; - - time_t now; - -Index: e2fsprogs-1.39-my-patches-from-ted/e2fsck/emptydir.c -=================================================================== ---- e2fsprogs-1.39-my-patches-from-ted.orig/e2fsck/emptydir.c -+++ e2fsprogs-1.39-my-patches-from-ted/e2fsck/emptydir.c -@@ -94,7 +94,7 @@ void add_empty_dirblock(empty_dir_info e - if (db->ino == 11) - return; /* Inode number 11 is usually lost+found */ - -- printf(_("Empty directory block %u (#%d) in inode %d\n"), -+ printf(_("Empty directory block %u (#%d) in inode %u\n"), - db->blk, db->blockcnt, db->ino); - - ext2fs_mark_block_bitmap(edi->empty_dir_blocks, db->blk); -Index: e2fsprogs-1.39-my-patches-from-ted/e2fsck/iscan.c -=================================================================== ---- e2fsprogs-1.39-my-patches-from-ted.orig/e2fsck/iscan.c -+++ e2fsprogs-1.39-my-patches-from-ted/e2fsck/iscan.c -@@ -98,7 +98,7 @@ int main (int argc, char *argv[]) - int exit_value = FSCK_OK; - ext2_filsys fs; - ext2_ino_t ino; -- int num_inodes = 0; -+ __u32 num_inodes = 0; - struct ext2_inode inode; - ext2_inode_scan scan; - -@@ -135,7 +135,7 @@ int main (int argc, char *argv[]) - } - - print_resource_track(NULL, &global_rtrack); -- printf(_("%d inodes scanned.\n"), num_inodes); -+ printf(_("%u inodes scanned.\n"), num_inodes); - - exit(0); - } -Index: e2fsprogs-1.39-my-patches-from-ted/e2fsck/unix.c -=================================================================== ---- e2fsprogs-1.39-my-patches-from-ted.orig/e2fsck/unix.c -+++ e2fsprogs-1.39-my-patches-from-ted/e2fsck/unix.c -@@ -98,7 +98,7 @@ static void usage(e2fsck_t ctx) - static void show_stats(e2fsck_t ctx) - { - ext2_filsys fs = ctx->fs; -- int inodes, inodes_used; -+ __u32 inodes, inodes_used; - blk_t blocks, blocks_used; - int dir_links; - int num_files, num_links; -@@ -118,49 +118,48 @@ static void show_stats(e2fsck_t ctx) - frag_percent = (frag_percent + 5) / 10; - - if (!verbose) { -- printf(_("%s: %d/%d files (%0d.%d%% non-contiguous), %u/%u blocks\n"), -+ printf(_("%s: %u/%u files (%0d.%d%% non-contiguous), %u/%u blocks\n"), - ctx->device_name, inodes_used, inodes, - frag_percent / 10, frag_percent % 10, - blocks_used, blocks); - return; - } -- printf (P_("\n%8d inode used (%d%%)\n", "\n%8d inodes used (%d%%)\n", -- inodes_used), inodes_used, 100 * inodes_used / inodes); -- printf (P_("%8d non-contiguous inode (%0d.%d%%)\n", -- "%8d non-contiguous inodes (%0d.%d%%)\n", -+ printf (P_("\n%8u inode used (%2.2f%%)\n", "\n%8u inodes used (%2.2f%%)\n", -+ inodes_used), inodes_used, 100.0 * inodes_used / inodes); -+ printf (P_("%8u non-contiguous inode (%0d.%d%%)\n", -+ "%8u non-contiguous inodes (%0d.%d%%)\n", - ctx->fs_fragmented), - ctx->fs_fragmented, frag_percent / 10, frag_percent % 10); -- printf (_(" # of inodes with ind/dind/tind blocks: %d/%d/%d\n"), -+ printf (_(" # of inodes with ind/dind/tind blocks: %u/%u/%u\n"), - ctx->fs_ind_count, ctx->fs_dind_count, ctx->fs_tind_count); -- printf (P_("%8u block used (%d%%)\n", "%8u blocks used (%d%%)\n", -- blocks_used), -- blocks_used, (int) ((long long) 100 * blocks_used / blocks)); -- printf (P_("%8d bad block\n", "%8d bad blocks\n", -+ printf (P_("%8u block used (%2.2f%%)\n", "%8u blocks used (%2.2f%%)\n", -+ blocks_used), blocks_used, 100.0 * blocks_used / blocks); -+ printf (P_("%8u bad block\n", "%8u bad blocks\n", - ctx->fs_badblocks_count), ctx->fs_badblocks_count); -- printf (P_("%8d large file\n", "%8d large files\n", -+ printf (P_("%8u large file\n", "%8u large files\n", - ctx->large_files), ctx->large_files); -- printf (P_("\n%8d regular file\n", "\n%8d regular files\n", -+ printf (P_("\n%8u regular file\n", "\n%8u regular files\n", - ctx->fs_regular_count), ctx->fs_regular_count); -- printf (P_("%8d directory\n", "%8d directories\n", -+ printf (P_("%8u directory\n", "%8u directories\n", - ctx->fs_directory_count), ctx->fs_directory_count); -- printf (P_("%8d character device file\n", -- "%8d character device files\n", ctx->fs_chardev_count), -+ printf (P_("%8u character device file\n", -+ "%8u character device files\n", ctx->fs_chardev_count), - ctx->fs_chardev_count); -- printf (P_("%8d block device file\n", "%8d block device files\n", -+ printf (P_("%8u block device file\n", "%8u block device files\n", - ctx->fs_blockdev_count), ctx->fs_blockdev_count); -- printf (P_("%8d fifo\n", "%8d fifos\n", ctx->fs_fifo_count), -+ printf (P_("%8u fifo\n", "%8u fifos\n", ctx->fs_fifo_count), - ctx->fs_fifo_count); -- printf (P_("%8d link\n", "%8d links\n", -+ printf (P_("%8u link\n", "%8u links\n", - ctx->fs_links_count - dir_links), - ctx->fs_links_count - dir_links); -- printf (P_("%8d symbolic link", "%8d symbolic links", -+ printf (P_("%8u symbolic link", "%8u symbolic links", - ctx->fs_symlinks_count), ctx->fs_symlinks_count); -- printf (P_(" (%d fast symbolic link)\n", " (%d fast symbolic links)\n", -+ printf (P_(" (%u fast symbolic link)\n", " (%u fast symbolic links)\n", - ctx->fs_fast_symlinks_count), ctx->fs_fast_symlinks_count); -- printf (P_("%8d socket\n", "%8d sockets\n", ctx->fs_sockets_count), -+ printf (P_("%8u socket\n", "%8u sockets\n", ctx->fs_sockets_count), - ctx->fs_sockets_count); - printf ("--------\n"); -- printf (P_("%8d file\n", "%8d files\n", -+ printf (P_("%8u file\n", "%8u files\n", - ctx->fs_total_count - dir_links), - ctx->fs_total_count - dir_links); - } -@@ -300,7 +299,7 @@ static void check_if_skip(e2fsck_t ctx) - fputs(_(", check forced.\n"), stdout); - return; - } -- printf(_("%s: clean, %d/%d files, %u/%u blocks"), ctx->device_name, -+ printf(_("%s: clean, %u/%u files, %u/%u blocks"), ctx->device_name, - fs->super->s_inodes_count - fs->super->s_free_inodes_count, - fs->super->s_inodes_count, - fs->super->s_blocks_count - fs->super->s_free_blocks_count, -Index: e2fsprogs-1.39-my-patches-from-ted/lib/ext2fs/ChangeLog -=================================================================== ---- e2fsprogs-1.39-my-patches-from-ted.orig/lib/ext2fs/ChangeLog -+++ e2fsprogs-1.39-my-patches-from-ted/lib/ext2fs/ChangeLog -@@ -1,5 +1,17 @@ - 2006-08-30 Eric Sandeen - -+ * bmove.c (process_block): -+ * getsize.c (main): -+ * icount.c (ext2fs_create_icount2, insert_icount_el): -+ * tst_badblocks.c (print_list, validate_test_seq, do_test_seq): -+ * tst_badblocks.c (invalid_proc): -+ * tst_getsize.c (main): -+ * tst_iscan.c (check_map): -+ * unix_io.c (raw_read_blk, unix_read_blk): -+ * write_bb_file.c (ext2fs_write_bb_FILE): Fix printf formats. -+ -+2006-08-30 Eric Sandeen -+ - * closefs.c (write_backup_super): - * initialize.c (ext2fs_initialize): Remove unused variables. - -Index: e2fsprogs-1.39-my-patches-from-ted/lib/ext2fs/bmove.c -=================================================================== ---- e2fsprogs-1.39-my-patches-from-ted.orig/lib/ext2fs/bmove.c -+++ e2fsprogs-1.39-my-patches-from-ted/lib/ext2fs/bmove.c -@@ -73,7 +73,7 @@ static int process_block(ext2_filsys fs, - ext2fs_mark_block_bitmap(pb->alloc_map, block); - ret = BLOCK_CHANGED; - if (pb->flags & EXT2_BMOVE_DEBUG) -- printf("ino=%ld, blockcnt=%lld, %d->%d\n", pb->ino, -+ printf("ino=%ld, blockcnt=%lld, %u->%u\n", pb->ino, - blockcnt, orig, block); - } - if (pb->add_dir) { -Index: e2fsprogs-1.39-my-patches-from-ted/lib/ext2fs/getsize.c -=================================================================== ---- e2fsprogs-1.39-my-patches-from-ted.orig/lib/ext2fs/getsize.c -+++ e2fsprogs-1.39-my-patches-from-ted/lib/ext2fs/getsize.c -@@ -302,7 +302,7 @@ int main(int argc, char **argv) - "while calling ext2fs_get_device_size"); - exit(1); - } -- printf("Device %s has %d 1k blocks.\n", argv[1], blocks); -+ printf("Device %s has %u 1k blocks.\n", argv[1], blocks); - exit(0); - } - #endif -Index: e2fsprogs-1.39-my-patches-from-ted/lib/ext2fs/icount.c -=================================================================== ---- e2fsprogs-1.39-my-patches-from-ted.orig/lib/ext2fs/icount.c -+++ e2fsprogs-1.39-my-patches-from-ted/lib/ext2fs/icount.c -@@ -116,7 +116,7 @@ errcode_t ext2fs_create_icount2(ext2_fil - - bytes = (size_t) (icount->size * sizeof(struct ext2_icount_el)); - #if 0 -- printf("Icount allocated %d entries, %d bytes.\n", -+ printf("Icount allocated %u entries, %d bytes.\n", - icount->size, bytes); - #endif - retval = ext2fs_get_mem(bytes, &icount->list); -@@ -176,7 +176,7 @@ static struct ext2_icount_el *insert_ico - if (new_size < (icount->size + 100)) - new_size = icount->size + 100; - #if 0 -- printf("Reallocating icount %d entries...\n", new_size); -+ printf("Reallocating icount %u entries...\n", new_size); - #endif - retval = ext2fs_resize_mem((size_t) icount->size * - sizeof(struct ext2_icount_el), -Index: e2fsprogs-1.39-my-patches-from-ted/lib/ext2fs/tst_badblocks.c -=================================================================== ---- e2fsprogs-1.39-my-patches-from-ted.orig/lib/ext2fs/tst_badblocks.c -+++ e2fsprogs-1.39-my-patches-from-ted/lib/ext2fs/tst_badblocks.c -@@ -103,7 +103,7 @@ static void print_list(badblocks_list bb - } - ok = i = 1; - while (ext2fs_badblocks_list_iterate(iter, &blk)) { -- printf("%d ", blk); -+ printf("%u ", blk); - if (i++ != blk) - ok = 0; - } -@@ -130,7 +130,7 @@ static void validate_test_seq(badblocks_ - ok = 0; - test_fail++; - } -- printf("\tblock %d is %s --- %s\n", vec[i], -+ printf("\tblock %u is %s --- %s\n", vec[i], - match ? "present" : "absent", - ok ? "OK" : "NOT OK"); - } -@@ -145,7 +145,7 @@ static void do_test_seq(badblocks_list b - case ADD_BLK: - ext2fs_badblocks_list_add(bb, vec[i]); - match = ext2fs_badblocks_list_test(bb, vec[i]); -- printf("Adding block %d --- now %s\n", vec[i], -+ printf("Adding block %u --- now %s\n", vec[i], - match ? "present" : "absent"); - if (!match) { - printf("FAILURE!\n"); -@@ -155,7 +155,7 @@ static void do_test_seq(badblocks_list b - case DEL_BLK: - ext2fs_badblocks_list_del(bb, vec[i]); - match = ext2fs_badblocks_list_test(bb, vec[i]); -- printf("Removing block %d --- now %s\n", vec[i], -+ printf("Removing block %u --- now %s\n", vec[i], - ext2fs_badblocks_list_test(bb, vec[i]) ? - "present" : "absent"); - if (match) { -@@ -209,7 +209,7 @@ static void invalid_proc(ext2_filsys fs, - printf("Expected invalid block\n"); - test_expected_fail++; - } else { -- printf("Invalid block #: %d\n", blk); -+ printf("Invalid block #: %u\n", blk); - test_fail++; - } - } -Index: e2fsprogs-1.39-my-patches-from-ted/lib/ext2fs/tst_getsize.c -=================================================================== ---- e2fsprogs-1.39-my-patches-from-ted.orig/lib/ext2fs/tst_getsize.c -+++ e2fsprogs-1.39-my-patches-from-ted/lib/ext2fs/tst_getsize.c -@@ -39,6 +39,6 @@ int main(int argc, const char *argv[]) - com_err(argv[0], retval, "while getting device size"); - exit(1); - } -- printf("%s is device has %d blocks.\n", argv[1], blocks); -+ printf("%s is device has %u blocks.\n", argv[1], blocks); - return 0; - } -Index: e2fsprogs-1.39-my-patches-from-ted/lib/ext2fs/tst_iscan.c -=================================================================== ---- e2fsprogs-1.39-my-patches-from-ted.orig/lib/ext2fs/tst_iscan.c -+++ e2fsprogs-1.39-my-patches-from-ted/lib/ext2fs/tst_iscan.c -@@ -175,7 +175,7 @@ static void check_map(void) - - for (i=0; test_vec[i]; i++) { - if (ext2fs_test_block_bitmap(touched_map, test_vec[i])) { -- printf("Bad block was touched --- %d\n", test_vec[i]); -+ printf("Bad block was touched --- %u\n", test_vec[i]); - failed++; - first_no_comma = 1; - } -@@ -199,7 +199,7 @@ static void check_map(void) - first = 0; - else - printf(", "); -- printf("%d", i); -+ printf("%u", i); - } - } - printf("\n"); -Index: e2fsprogs-1.39-my-patches-from-ted/lib/ext2fs/unix_io.c -=================================================================== ---- e2fsprogs-1.39-my-patches-from-ted.orig/lib/ext2fs/unix_io.c -+++ e2fsprogs-1.39-my-patches-from-ted/lib/ext2fs/unix_io.c -@@ -170,8 +170,8 @@ static errcode_t raw_read_blk(io_channel - size = (count < 0) ? -count : count * channel->block_size; - location = ((ext2_loff_t) block * channel->block_size) + data->offset; - #ifdef DEBUG -- printf("count=%d, size=%d, block=%d, blk_size=%d, location=%lx\n", -- count, size, block, channel->block_size, location); -+ printf("count=%d, size=%d, block=%lu, blk_size=%d, location=%llx\n", -+ count, size, block, channel->block_size, (long long)location); - #endif - if (ext2fs_llseek(data->dev, location, SEEK_SET) != location) { - retval = errno ? errno : EXT2_ET_LLSEEK_FAILED; -@@ -553,7 +553,7 @@ static errcode_t unix_read_blk(io_channe - /* If it's in the cache, use it! */ - if ((cache = find_cached_block(data, block, &reuse[0]))) { - #ifdef DEBUG -- printf("Using cached block %d\n", block); -+ printf("Using cached block %lu\n", block); - #endif - memcpy(cp, cache->buf, channel->block_size); - count--; -@@ -569,7 +569,7 @@ static errcode_t unix_read_blk(io_channe - if (find_cached_block(data, block+i, &reuse[i])) - break; - #ifdef DEBUG -- printf("Reading %d blocks starting at %d\n", i, block); -+ printf("Reading %d blocks starting at %lu\n", i, block); - #endif - if ((retval = raw_read_blk(channel, data, block, i, cp))) - return retval; -Index: e2fsprogs-1.39-my-patches-from-ted/lib/ext2fs/write_bb_file.c -=================================================================== ---- e2fsprogs-1.39-my-patches-from-ted.orig/lib/ext2fs/write_bb_file.c -+++ e2fsprogs-1.39-my-patches-from-ted/lib/ext2fs/write_bb_file.c -@@ -27,7 +27,7 @@ errcode_t ext2fs_write_bb_FILE(ext2_badb - return retval; - - while (ext2fs_badblocks_list_iterate(bb_iter, &blk)) { -- fprintf(f, "%d\n", blk); -+ fprintf(f, "%u\n", blk); - } - ext2fs_badblocks_list_iterate_end(bb_iter); - return 0; -Index: e2fsprogs-1.39-my-patches-from-ted/misc/ChangeLog -=================================================================== ---- e2fsprogs-1.39-my-patches-from-ted.orig/misc/ChangeLog -+++ e2fsprogs-1.39-my-patches-from-ted/misc/ChangeLog -@@ -1,5 +1,11 @@ - 2006-08-30 Eric Sandeen - -+ * dumpe2fs.c (list_bad_blocks): -+ * e2image.c (output_meta_data_blocks, write_raw_image_file): -+ * mke2fs.c (test_disk, handle_bad_blocks): Fix printf formats. -+ -+2006-08-30 Eric Sandeen -+ - * e2image.c (mark_table_blocks): Remove unused first_block - incrementing from loop. - -Index: e2fsprogs-1.39-my-patches-from-ted/misc/dumpe2fs.c -=================================================================== ---- e2fsprogs-1.39-my-patches-from-ted.orig/misc/dumpe2fs.c -+++ e2fsprogs-1.39-my-patches-from-ted/misc/dumpe2fs.c -@@ -250,10 +250,10 @@ static void list_bad_blocks(ext2_filsys - return; - } - if (dump) { -- header = fmt = "%d\n"; -+ header = fmt = "%u\n"; - } else { -- header = _("Bad blocks: %d"); -- fmt = ", %d"; -+ header = _("Bad blocks: %u"); -+ fmt = ", %u"; - } - while (ext2fs_badblocks_list_iterate(bb_iter, &blk)) { - printf(header ? header : fmt, blk); -Index: e2fsprogs-1.39-my-patches-from-ted/misc/e2image.c -=================================================================== ---- e2fsprogs-1.39-my-patches-from-ted.orig/misc/e2image.c -+++ e2fsprogs-1.39-my-patches-from-ted/misc/e2image.c -@@ -417,7 +417,7 @@ static void output_meta_data_blocks(ext2 - retval = io_channel_read_blk(fs->io, blk, 1, buf); - if (retval) { - com_err(program_name, retval, -- "error reading block %d", blk); -+ "error reading block %u", blk); - } - if (scramble_block_map && - ext2fs_test_block_bitmap(scramble_block_map, blk)) -@@ -516,7 +516,7 @@ static void write_raw_image_file(ext2_fi - block_buf, process_dir_block, &pb); - if (retval) { - com_err(program_name, retval, -- "while iterating over inode %d", -+ "while iterating over inode %u", - ino); - exit(1); - } -@@ -529,7 +529,7 @@ static void write_raw_image_file(ext2_fi - process_file_block, &pb); - if (retval) { - com_err(program_name, retval, -- "while iterating over %d", ino); -+ "while iterating over inode %u", ino); - exit(1); - } - } -Index: e2fsprogs-1.39-my-patches-from-ted/misc/mke2fs.c -=================================================================== ---- e2fsprogs-1.39-my-patches-from-ted.orig/misc/mke2fs.c -+++ e2fsprogs-1.39-my-patches-from-ted/misc/mke2fs.c -@@ -188,7 +188,7 @@ static void test_disk(ext2_filsys fs, ba - errcode_t retval; - char buf[1024]; - -- sprintf(buf, "badblocks -b %d -X %s%s%s %d", fs->blocksize, -+ sprintf(buf, "badblocks -b %d -X %s%s%s %u", fs->blocksize, - quiet ? "" : "-s ", (cflag > 1) ? "-w " : "", - fs->device_name, fs->super->s_blocks_count); - if (verbose) -@@ -232,7 +232,7 @@ static void handle_bad_blocks(ext2_filsy - if (ext2fs_badblocks_list_test(bb_list, i)) { - fprintf(stderr, _("Block %d in primary " - "superblock/group descriptor area bad.\n"), i); -- fprintf(stderr, _("Blocks %u through %d must be good " -+ fprintf(stderr, _("Blocks %u through %u must be good " - "in order to build a filesystem.\n"), - fs->super->s_first_data_block, must_be_good); - fputs(_("Aborting....\n"), stderr); -Index: e2fsprogs-1.39-my-patches-from-ted/resize/ChangeLog -=================================================================== ---- e2fsprogs-1.39-my-patches-from-ted.orig/resize/ChangeLog -+++ e2fsprogs-1.39-my-patches-from-ted/resize/ChangeLog -@@ -1,5 +1,9 @@ - 2006-08-30 Eric Sandeen - -+ * online.c (online_resize_fs): Fix printf formats. -+ -+2006-08-30 Eric Sandeen -+ - * resize2fs.c (mark_table_blocks): Remove unused variable. - - 2006-08-30 Theodore Tso -Index: e2fsprogs-1.39-my-patches-from-ted/resize/online.c -=================================================================== ---- e2fsprogs-1.39-my-patches-from-ted.orig/resize/online.c -+++ e2fsprogs-1.39-my-patches-from-ted/resize/online.c -@@ -74,7 +74,7 @@ errcode_t online_resize_fs(ext2_filsys f - if (retval) - return retval; - -- printf(_("Performing an on-line resize of %s to %d (%dk) blocks.\n"), -+ printf(_("Performing an on-line resize of %s to %u (%dk) blocks.\n"), - fs->device_name, *new_size, fs->blocksize / 1024); - - size = fs->group_desc_count * sb->s_blocks_per_group + -@@ -116,7 +116,7 @@ errcode_t online_resize_fs(ext2_filsys f - printf("new inode table is at 0x%04x-0x%04x\n", - input.inode_table, - input.inode_table + new_fs->inode_blocks_per_group-1); -- printf("new group has %d blocks\n", input.blocks_count); -+ printf("new group has %u blocks\n", input.blocks_count); - printf("new group will reserve %d blocks\n", - input.reserved_blocks); - printf("new group has %d free blocks\n", diff --git a/e2fsprogs-1.39-group_block_inlines.patch b/e2fsprogs-1.39-group_block_inlines.patch deleted file mode 100644 index cd5c222..0000000 --- a/e2fsprogs-1.39-group_block_inlines.patch +++ /dev/null @@ -1,288 +0,0 @@ -# HG changeset patch -# User tytso@mit.edu -# Date Tue Sep 12 14:56:16 2006 -0400 -# Node ID 1aa8aca8acebca38b38ee003c17a045bc5fde185 -# parent: 4b504bc7413f5ef17f8b62f4b3479da6bfa83efb -Create new ext2fs library inlines: ext2fs_group_{first,last}_block() - -Create new ext2fs library inline functions in order to calculate -the starting and ending blocks in a block group. - -Signed-off-by: Eric Sandeen - -Index: e2fsprogs-1.39-my-patches-from-ted/e2fsck/ChangeLog -=================================================================== ---- e2fsprogs-1.39-my-patches-from-ted.orig/e2fsck/ChangeLog -+++ e2fsprogs-1.39-my-patches-from-ted/e2fsck/ChangeLog -@@ -1,5 +1,11 @@ - 2006-08-30 Eric Sandeen - -+ * pass1.c (new_table_block, handle_fs_bad_blocks): -+ * super.c (check_super_block): -+ Use new inlines to calculate group first & last blocks. -+ -+2006-08-30 Eric Sandeen -+ - * e2fsck.h (e2fsck): Use unsigned types for filesystem counters. - * emptydir.c (add_empty_dirblock): - * iscan.c (main): -Index: e2fsprogs-1.39-my-patches-from-ted/e2fsck/pass1.c -=================================================================== ---- e2fsprogs-1.39-my-patches-from-ted.orig/e2fsck/pass1.c -+++ e2fsprogs-1.39-my-patches-from-ted/e2fsck/pass1.c -@@ -1890,6 +1890,7 @@ static void new_table_block(e2fsck_t ctx - { - ext2_filsys fs = ctx->fs; - blk_t old_block = *new_block; -+ blk_t last_block; - int i; - char *buf; - struct problem_context pctx; -@@ -1900,8 +1901,8 @@ static void new_table_block(e2fsck_t ctx - pctx.blk = old_block; - pctx.str = name; - -- pctx.errcode = ext2fs_get_free_blocks(fs, first_block, -- first_block + fs->super->s_blocks_per_group, -+ last_block = ext2fs_group_last_block(fs, group); -+ pctx.errcode = ext2fs_get_free_blocks(fs, first_block, last_block, - num, ctx->block_found_map, new_block); - if (pctx.errcode) { - pctx.num = num; -@@ -1952,9 +1953,11 @@ static void handle_fs_bad_blocks(e2fsck_ - { - ext2_filsys fs = ctx->fs; - dgrp_t i; -- int first_block = fs->super->s_first_data_block; -+ int first_block; - - for (i = 0; i < fs->group_desc_count; i++) { -+ first_block = ext2fs_group_first_block(fs, i); -+ - if (ctx->invalid_block_bitmap_flag[i]) { - new_table_block(ctx, first_block, i, _("block bitmap"), - 1, &fs->group_desc[i].bg_block_bitmap); -@@ -1969,7 +1972,6 @@ static void handle_fs_bad_blocks(e2fsck_ - &fs->group_desc[i].bg_inode_table); - ctx->flags |= E2F_FLAG_RESTART; - } -- first_block += fs->super->s_blocks_per_group; - } - ctx->invalid_bitmaps = 0; - } -Index: e2fsprogs-1.39-my-patches-from-ted/e2fsck/super.c -=================================================================== ---- e2fsprogs-1.39-my-patches-from-ted.orig/e2fsck/super.c -+++ e2fsprogs-1.39-my-patches-from-ted/e2fsck/super.c -@@ -569,11 +569,9 @@ void check_super_block(e2fsck_t ctx) - - for (i = 0, gd=fs->group_desc; i < fs->group_desc_count; i++, gd++) { - pctx.group = i; -- -- if (i == fs->group_desc_count - 1) -- last_block = sb->s_blocks_count - 1; -- else -- last_block = first_block + blocks_per_group - 1; -+ -+ first_block = ext2fs_group_first_block(fs, i); -+ last_block = ext2fs_group_last_block(fs, i); - - if ((gd->bg_block_bitmap < first_block) || - (gd->bg_block_bitmap > last_block)) { -@@ -608,7 +606,6 @@ void check_super_block(e2fsck_t ctx) - } - free_blocks += gd->bg_free_blocks_count; - free_inodes += gd->bg_free_inodes_count; -- first_block += sb->s_blocks_per_group; - - if ((gd->bg_free_blocks_count > sb->s_blocks_per_group) || - (gd->bg_free_inodes_count > sb->s_inodes_per_group) || -Index: e2fsprogs-1.39-my-patches-from-ted/lib/ext2fs/ChangeLog -=================================================================== ---- e2fsprogs-1.39-my-patches-from-ted.orig/lib/ext2fs/ChangeLog -+++ e2fsprogs-1.39-my-patches-from-ted/lib/ext2fs/ChangeLog -@@ -1,5 +1,13 @@ - 2006-08-30 Eric Sandeen - -+ * alloc_tables.c (ext2fs_allocate_group_table): -+ * check_desc.c (ext2fs_check_desc): -+ Use new inlines to calculate group first & last blocks. -+ * ext2fs.h: -+ Create new inlines to calculate first/last group blocks. -+ -+2006-08-30 Eric Sandeen -+ - * bmove.c (process_block): - * getsize.c (main): - * icount.c (ext2fs_create_icount2, insert_icount_el): -Index: e2fsprogs-1.39-my-patches-from-ted/lib/ext2fs/alloc_tables.c -=================================================================== ---- e2fsprogs-1.39-my-patches-from-ted.orig/lib/ext2fs/alloc_tables.c -+++ e2fsprogs-1.39-my-patches-from-ted/lib/ext2fs/alloc_tables.c -@@ -34,12 +34,8 @@ errcode_t ext2fs_allocate_group_table(ex - blk_t group_blk, start_blk, last_blk, new_blk, blk; - int j; - -- group_blk = fs->super->s_first_data_block + -- (group * fs->super->s_blocks_per_group); -- -- last_blk = group_blk + fs->super->s_blocks_per_group; -- if (last_blk >= fs->super->s_blocks_count) -- last_blk = fs->super->s_blocks_count - 1; -+ group_blk = ext2fs_group_first_block(fs, group); -+ last_blk = ext2fs_group_last_block(fs, group); - - if (!bmap) - bmap = fs->block_map; -@@ -54,8 +50,8 @@ errcode_t ext2fs_allocate_group_table(ex - return retval; - start_blk += fs->inode_blocks_per_group; - start_blk += ((fs->stride * group) % -- (last_blk - start_blk)); -- if (start_blk > last_blk) -+ (last_blk - start_blk + 1)); -+ if (start_blk >= last_blk) - start_blk = group_blk; - } else - start_blk = group_blk; -Index: e2fsprogs-1.39-my-patches-from-ted/lib/ext2fs/check_desc.c -=================================================================== ---- e2fsprogs-1.39-my-patches-from-ted.orig/lib/ext2fs/check_desc.c -+++ e2fsprogs-1.39-my-patches-from-ted/lib/ext2fs/check_desc.c -@@ -38,11 +38,9 @@ errcode_t ext2fs_check_desc(ext2_filsys - EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS); - - for (i = 0; i < fs->group_desc_count; i++) { -- if (i == fs->group_desc_count - 1) -- last_block = fs->super->s_blocks_count - 1; -- else -- last_block = first_block + -- fs->super->s_blocks_per_group - 1; -+ first_block = ext2fs_group_first_block(fs, i); -+ last_block = ext2fs_group_last_block(fs, i); -+ - /* - * Check to make sure block bitmap for group is - * located within the group. -@@ -65,8 +63,6 @@ errcode_t ext2fs_check_desc(ext2_filsys - ((fs->group_desc[i].bg_inode_table + - fs->inode_blocks_per_group) > last_block)) - return EXT2_ET_GDESC_BAD_INODE_TABLE; -- -- first_block += fs->super->s_blocks_per_group; - } - return 0; - } -Index: e2fsprogs-1.39-my-patches-from-ted/lib/ext2fs/ext2fs.h -=================================================================== ---- e2fsprogs-1.39-my-patches-from-ted.orig/lib/ext2fs/ext2fs.h -+++ e2fsprogs-1.39-my-patches-from-ted/lib/ext2fs/ext2fs.h -@@ -967,6 +967,8 @@ extern int ext2fs_test_ib_dirty(ext2_fil - extern int ext2fs_test_bb_dirty(ext2_filsys fs); - extern int ext2fs_group_of_blk(ext2_filsys fs, blk_t blk); - extern int ext2fs_group_of_ino(ext2_filsys fs, ext2_ino_t ino); -+extern blk_t ext2fs_group_first_block(ext2_filsys fs, dgrp_t group); -+extern blk_t ext2fs_group_last_block(ext2_filsys fs, dgrp_t group); - extern blk_t ext2fs_inode_data_blocks(ext2_filsys fs, - struct ext2_inode *inode); - extern unsigned int ext2fs_div_ceil(unsigned int a, unsigned int b); -@@ -1131,6 +1133,26 @@ _INLINE_ int ext2fs_group_of_ino(ext2_fi - return (ino - 1) / fs->super->s_inodes_per_group; - } - -+/* -+ * Return the first block (inclusive) in a group -+ */ -+_INLINE_ blk_t ext2fs_group_first_block(ext2_filsys fs, dgrp_t group) -+{ -+ return fs->super->s_first_data_block + -+ (group * fs->super->s_blocks_per_group); -+} -+ -+/* -+ * Return the last block (inclusive) in a group -+ */ -+_INLINE_ blk_t ext2fs_group_last_block(ext2_filsys fs, dgrp_t group) -+{ -+ return (group == fs->group_desc_count - 1 ? -+ fs->super->s_blocks_count - 1 : -+ ext2fs_group_first_block(fs, group) + -+ (fs->super->s_blocks_per_group - 1)); -+} -+ - _INLINE_ blk_t ext2fs_inode_data_blocks(ext2_filsys fs, - struct ext2_inode *inode) - { -Index: e2fsprogs-1.39-my-patches-from-ted/misc/ChangeLog -=================================================================== ---- e2fsprogs-1.39-my-patches-from-ted.orig/misc/ChangeLog -+++ e2fsprogs-1.39-my-patches-from-ted/misc/ChangeLog -@@ -1,5 +1,10 @@ - 2006-08-30 Eric Sandeen - -+ * dumpe2fs.c (list_desc): Use new inlines to calculate group -+ first & last blocks. -+ -+2006-08-30 Eric Sandeen -+ - * dumpe2fs.c (list_bad_blocks): - * e2image.c (output_meta_data_blocks, write_raw_image_file): - * mke2fs.c (test_disk, handle_bad_blocks): Fix printf formats. -Index: e2fsprogs-1.39-my-patches-from-ted/misc/dumpe2fs.c -=================================================================== ---- e2fsprogs-1.39-my-patches-from-ted.orig/misc/dumpe2fs.c -+++ e2fsprogs-1.39-my-patches-from-ted/misc/dumpe2fs.c -@@ -153,13 +153,11 @@ static void list_desc (ext2_filsys fs) - else - old_desc_blocks = fs->desc_blocks; - for (i = 0; i < fs->group_desc_count; i++) { -+ first_block = ext2fs_group_first_block(fs, i); -+ last_block = ext2fs_group_last_block(fs, i); -+ - ext2fs_super_and_bgd_loc(fs, i, &super_blk, - &old_desc_blk, &new_desc_blk, 0); -- if (i == fs->group_desc_count - 1) -- last_block = fs->super->s_blocks_count - 1; -- else -- last_block = first_block + -- fs->super->s_blocks_per_group - 1; - - printf (_("Group %lu: (Blocks "), i); - print_range(first_block, last_block); -@@ -226,7 +224,6 @@ static void list_desc (ext2_filsys fs) - fputc('\n', stdout); - inode_bitmap += fs->super->s_inodes_per_group / 8; - } -- first_block += fs->super->s_blocks_per_group; - } - } - -Index: e2fsprogs-1.39-my-patches-from-ted/tests/ChangeLog -=================================================================== ---- e2fsprogs-1.39-my-patches-from-ted.orig/tests/ChangeLog -+++ e2fsprogs-1.39-my-patches-from-ted/tests/ChangeLog -@@ -1,3 +1,9 @@ -+2006-08-30 Eric Sandeen -+ -+ * m_raid_opt/expect.1: -+ Change expected values for last group due to correctly -+ calculated last block when using strides. -+ - 2006-05-28 Theodore Tso - - * test_config: Unset all locale-related environment variables -Index: e2fsprogs-1.39-my-patches-from-ted/tests/m_raid_opt/expect.1 -=================================================================== ---- e2fsprogs-1.39-my-patches-from-ted.orig/tests/m_raid_opt/expect.1 -+++ e2fsprogs-1.39-my-patches-from-ted/tests/m_raid_opt/expect.1 -@@ -944,8 +944,8 @@ Group 126: (Blocks 129025-130048) - Free inodes: 32257-32512 - Group 127: (Blocks 130049-131071) - Group descriptor at 130049 -- Block bitmap at 130744 (+695), Inode bitmap at 130745 (+696) -+ Block bitmap at 130743 (+694), Inode bitmap at 130744 (+695) - Inode table at 130050-130081 (+1) - 988 free blocks, 256 free inodes, 0 directories -- Free blocks: 130082-130743, 130746-131071 -+ Free blocks: 130082-130742, 130745-131071 - Free inodes: 32513-32768 diff --git a/e2fsprogs-1.39-group_desc_loops.patch b/e2fsprogs-1.39-group_desc_loops.patch deleted file mode 100644 index c98a1c9..0000000 --- a/e2fsprogs-1.39-group_desc_loops.patch +++ /dev/null @@ -1,319 +0,0 @@ -# HG changeset patch -# User tytso@mit.edu -# Date Tue Sep 12 14:55:22 2006 -0400 -# Node ID 90cd01f7fcd6293846f0b3ca6ce2b007e3dd7d51 -# parent: cb841a8195a7aa87e8d0c95686291e8fb53358df -Fix loops over group descriptors to prevent 2**32-1 block number overflows - -For loops iterating over all group descriptors, consistently define -first_block and last_block in a way that they are inclusive of the -range, and do not overflow. - -Previously on the last block group we did a test of <= first + -dec_blocks; this would actually wrap back to 0 for a total block count -of 2^32-1 - -Also add handling of last block group which may be smaller. - -Signed-off-by: Eric Sandeen - -Index: e2fsprogs-1.39-my-patches-from-ted/e2fsck/ChangeLog -=================================================================== ---- e2fsprogs-1.39-my-patches-from-ted.orig/e2fsck/ChangeLog -+++ e2fsprogs-1.39-my-patches-from-ted/e2fsck/ChangeLog -@@ -1,3 +1,11 @@ -+2006-08-30 Eric Sandeen -+ -+ * pass1b.c (check_if_fs_block): Change block group loop to use -+ a common pattern of first_block/last_block, etc. -+ -+ * super.c (check_super_block): Avoid overflows when iterating over -+ group descriptors on very large filesystems -+ - 2006-08-30 Theodore Tso - - * pass5.c (check_inode_bitmaps, check_inode_end, check_block_end): -Index: e2fsprogs-1.39-my-patches-from-ted/e2fsck/pass1b.c -=================================================================== ---- e2fsprogs-1.39-my-patches-from-ted.orig/e2fsck/pass1b.c -+++ e2fsprogs-1.39-my-patches-from-ted/e2fsck/pass1b.c -@@ -779,16 +779,16 @@ errout: - static int check_if_fs_block(e2fsck_t ctx, blk_t test_block) - { - ext2_filsys fs = ctx->fs; -- blk_t block; -+ blk_t first_block; - dgrp_t i; - -- block = fs->super->s_first_data_block; -+ first_block = fs->super->s_first_data_block; - for (i = 0; i < fs->group_desc_count; i++) { - -- /* Check superblocks/block group descriptros */ -+ /* Check superblocks/block group descriptors */ - if (ext2fs_bg_has_super(fs, i)) { -- if (test_block >= block && -- (test_block <= block + fs->desc_blocks)) -+ if (test_block >= first_block && -+ (test_block <= first_block + fs->desc_blocks)) - return 1; - } - -@@ -804,7 +804,7 @@ static int check_if_fs_block(e2fsck_t ct - (test_block == fs->group_desc[i].bg_inode_bitmap)) - return 1; - -- block += fs->super->s_blocks_per_group; -+ first_block += fs->super->s_blocks_per_group; - } - return 0; - } -Index: e2fsprogs-1.39-my-patches-from-ted/e2fsck/super.c -=================================================================== ---- e2fsprogs-1.39-my-patches-from-ted.orig/e2fsck/super.c -+++ e2fsprogs-1.39-my-patches-from-ted/e2fsck/super.c -@@ -566,15 +566,17 @@ void check_super_block(e2fsck_t ctx) - * Verify the group descriptors.... - */ - first_block = sb->s_first_data_block; -- last_block = first_block + blocks_per_group; - - for (i = 0, gd=fs->group_desc; i < fs->group_desc_count; i++, gd++) { - pctx.group = i; - - if (i == fs->group_desc_count - 1) -- last_block = sb->s_blocks_count; -+ last_block = sb->s_blocks_count - 1; -+ else -+ last_block = first_block + blocks_per_group - 1; -+ - if ((gd->bg_block_bitmap < first_block) || -- (gd->bg_block_bitmap >= last_block)) { -+ (gd->bg_block_bitmap > last_block)) { - pctx.blk = gd->bg_block_bitmap; - if (fix_problem(ctx, PR_0_BB_NOT_GROUP, &pctx)) - gd->bg_block_bitmap = 0; -@@ -584,7 +586,7 @@ void check_super_block(e2fsck_t ctx) - ctx->invalid_bitmaps++; - } - if ((gd->bg_inode_bitmap < first_block) || -- (gd->bg_inode_bitmap >= last_block)) { -+ (gd->bg_inode_bitmap > last_block)) { - pctx.blk = gd->bg_inode_bitmap; - if (fix_problem(ctx, PR_0_IB_NOT_GROUP, &pctx)) - gd->bg_inode_bitmap = 0; -@@ -595,7 +597,7 @@ void check_super_block(e2fsck_t ctx) - } - if ((gd->bg_inode_table < first_block) || - ((gd->bg_inode_table + -- fs->inode_blocks_per_group - 1) >= last_block)) { -+ fs->inode_blocks_per_group - 1) > last_block)) { - pctx.blk = gd->bg_inode_table; - if (fix_problem(ctx, PR_0_ITABLE_NOT_GROUP, &pctx)) - gd->bg_inode_table = 0; -@@ -607,7 +609,6 @@ void check_super_block(e2fsck_t ctx) - free_blocks += gd->bg_free_blocks_count; - free_inodes += gd->bg_free_inodes_count; - first_block += sb->s_blocks_per_group; -- last_block += sb->s_blocks_per_group; - - if ((gd->bg_free_blocks_count > sb->s_blocks_per_group) || - (gd->bg_free_inodes_count > sb->s_inodes_per_group) || -Index: e2fsprogs-1.39-my-patches-from-ted/lib/ext2fs/ChangeLog -=================================================================== ---- e2fsprogs-1.39-my-patches-from-ted.orig/lib/ext2fs/ChangeLog -+++ e2fsprogs-1.39-my-patches-from-ted/lib/ext2fs/ChangeLog -@@ -1,3 +1,8 @@ -+2006-08-30 Eric Sandeen -+ -+ * check_desc.c (ext2fs_check_desc): avoid overflows when iterating -+ over group descriptors on very large filesystems. -+ - 2006-08-30 Theodore Tso - - * bitmaps.c (ext2fs_set_bitmap_padding): Fix potential overflow -Index: e2fsprogs-1.39-my-patches-from-ted/lib/ext2fs/check_desc.c -=================================================================== ---- e2fsprogs-1.39-my-patches-from-ted.orig/lib/ext2fs/check_desc.c -+++ e2fsprogs-1.39-my-patches-from-ted/lib/ext2fs/check_desc.c -@@ -32,37 +32,41 @@ - errcode_t ext2fs_check_desc(ext2_filsys fs) - { - dgrp_t i; -- blk_t block = fs->super->s_first_data_block; -- blk_t next; -+ blk_t first_block = fs->super->s_first_data_block; -+ blk_t last_block; - - EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS); - - for (i = 0; i < fs->group_desc_count; i++) { -- next = block + fs->super->s_blocks_per_group; -+ if (i == fs->group_desc_count - 1) -+ last_block = fs->super->s_blocks_count - 1; -+ else -+ last_block = first_block + -+ fs->super->s_blocks_per_group - 1; - /* - * Check to make sure block bitmap for group is - * located within the group. - */ -- if (fs->group_desc[i].bg_block_bitmap < block || -- fs->group_desc[i].bg_block_bitmap >= next) -+ if (fs->group_desc[i].bg_block_bitmap < first_block || -+ fs->group_desc[i].bg_block_bitmap > last_block) - return EXT2_ET_GDESC_BAD_BLOCK_MAP; - /* - * Check to make sure inode bitmap for group is - * located within the group - */ -- if (fs->group_desc[i].bg_inode_bitmap < block || -- fs->group_desc[i].bg_inode_bitmap >= next) -+ if (fs->group_desc[i].bg_inode_bitmap < first_block || -+ fs->group_desc[i].bg_inode_bitmap > last_block) - return EXT2_ET_GDESC_BAD_INODE_MAP; - /* - * Check to make sure inode table for group is located - * within the group - */ -- if (fs->group_desc[i].bg_inode_table < block || -+ if (fs->group_desc[i].bg_inode_table < first_block || - ((fs->group_desc[i].bg_inode_table + -- fs->inode_blocks_per_group) >= next)) -+ fs->inode_blocks_per_group) > last_block)) - return EXT2_ET_GDESC_BAD_INODE_TABLE; - -- block = next; -+ first_block += fs->super->s_blocks_per_group; - } - return 0; - } -Index: e2fsprogs-1.39-my-patches-from-ted/misc/ChangeLog -=================================================================== ---- e2fsprogs-1.39-my-patches-from-ted.orig/misc/ChangeLog -+++ e2fsprogs-1.39-my-patches-from-ted/misc/ChangeLog -@@ -1,3 +1,12 @@ -+2006-08-30 Eric Sandeen -+ -+ * dumpe2fs.c (list_desc, mark_table_blocks): Avoid overflows when -+ iterating over group descriptors on very large -+ filesystems. -+ -+ * e2image.c (mark_table_blocks): Change block group loop to use a -+ common pattern of first_block/last_block, etc. -+ - 2006-08-30 Theodore Tso - - * tune2fs.c (main), mke2fs.c (PRS): Use e2p_percent to properly -Index: e2fsprogs-1.39-my-patches-from-ted/misc/dumpe2fs.c -=================================================================== ---- e2fsprogs-1.39-my-patches-from-ted.orig/misc/dumpe2fs.c -+++ e2fsprogs-1.39-my-patches-from-ted/misc/dumpe2fs.c -@@ -130,7 +130,7 @@ static void list_desc (ext2_filsys fs) - { - unsigned long i; - long diff; -- blk_t group_blk, next_blk; -+ blk_t first_block, last_block; - blk_t super_blk, old_desc_blk, new_desc_blk; - char *block_bitmap=NULL, *inode_bitmap=NULL; - int inode_blocks_per_group, old_desc_blocks, reserved_gdt; -@@ -147,7 +147,7 @@ static void list_desc (ext2_filsys fs) - EXT2_BLOCK_SIZE(fs->super); - reserved_gdt = fs->super->s_reserved_gdt_blocks; - fputc('\n', stdout); -- group_blk = fs->super->s_first_data_block; -+ first_block = fs->super->s_first_data_block; - if (fs->super->s_feature_incompat & EXT2_FEATURE_INCOMPAT_META_BG) - old_desc_blocks = fs->super->s_first_meta_bg; - else -@@ -155,11 +155,14 @@ static void list_desc (ext2_filsys fs) - for (i = 0; i < fs->group_desc_count; i++) { - ext2fs_super_and_bgd_loc(fs, i, &super_blk, - &old_desc_blk, &new_desc_blk, 0); -- next_blk = group_blk + fs->super->s_blocks_per_group; -- if (next_blk > fs->super->s_blocks_count) -- next_blk = fs->super->s_blocks_count; -+ if (i == fs->group_desc_count - 1) -+ last_block = fs->super->s_blocks_count - 1; -+ else -+ last_block = first_block + -+ fs->super->s_blocks_per_group - 1; -+ - printf (_("Group %lu: (Blocks "), i); -- print_range(group_blk, next_blk - 1); -+ print_range(first_block, last_block); - fputs(")", stdout); - print_bg_opts(fs, i); - has_super = ((i==0) || super_blk); -@@ -188,19 +191,19 @@ static void list_desc (ext2_filsys fs) - fputc('\n', stdout); - fputs(_(" Block bitmap at "), stdout); - print_number(fs->group_desc[i].bg_block_bitmap); -- diff = fs->group_desc[i].bg_block_bitmap - group_blk; -+ diff = fs->group_desc[i].bg_block_bitmap - first_block; - if (diff >= 0) - printf(" (+%ld)", diff); - fputs(_(", Inode bitmap at "), stdout); - print_number(fs->group_desc[i].bg_inode_bitmap); -- diff = fs->group_desc[i].bg_inode_bitmap - group_blk; -+ diff = fs->group_desc[i].bg_inode_bitmap - first_block; - if (diff >= 0) - printf(" (+%ld)", diff); - fputs(_("\n Inode table at "), stdout); - print_range(fs->group_desc[i].bg_inode_table, - fs->group_desc[i].bg_inode_table + - inode_blocks_per_group - 1); -- diff = fs->group_desc[i].bg_inode_table - group_blk; -+ diff = fs->group_desc[i].bg_inode_table - first_block; - if (diff > 0) - printf(" (+%ld)", diff); - printf (_("\n %d free blocks, %d free inodes, " -@@ -223,7 +226,7 @@ static void list_desc (ext2_filsys fs) - fputc('\n', stdout); - inode_bitmap += fs->super->s_inodes_per_group / 8; - } -- group_blk = next_blk; -+ first_block += fs->super->s_blocks_per_group; - } - } - -Index: e2fsprogs-1.39-my-patches-from-ted/misc/e2image.c -=================================================================== ---- e2fsprogs-1.39-my-patches-from-ted.orig/misc/e2image.c -+++ e2fsprogs-1.39-my-patches-from-ted/misc/e2image.c -@@ -244,21 +244,21 @@ static int process_file_block(ext2_filsy - - static void mark_table_blocks(ext2_filsys fs) - { -- blk_t block, b; -+ blk_t first_block, b; - unsigned int i,j; - -- block = fs->super->s_first_data_block; -+ first_block = fs->super->s_first_data_block; - /* - * Mark primary superblock - */ -- ext2fs_mark_block_bitmap(meta_block_map, block); -+ ext2fs_mark_block_bitmap(meta_block_map, first_block); - - /* - * Mark the primary superblock descriptors - */ - for (j = 0; j < fs->desc_blocks; j++) { - ext2fs_mark_block_bitmap(meta_block_map, -- ext2fs_descriptor_block_loc(fs, block, j)); -+ ext2fs_descriptor_block_loc(fs, first_block, j)); - } - - for (i = 0; i < fs->group_desc_count; i++) { -@@ -287,7 +287,7 @@ static void mark_table_blocks(ext2_filsy - ext2fs_mark_block_bitmap(meta_block_map, - fs->group_desc[i].bg_inode_bitmap); - } -- block += fs->super->s_blocks_per_group; -+ first_block += fs->super->s_blocks_per_group; - } - } - diff --git a/e2fsprogs-1.39-large_file_size.patch b/e2fsprogs-1.39-large_file_size.patch deleted file mode 100644 index 684aefc..0000000 --- a/e2fsprogs-1.39-large_file_size.patch +++ /dev/null @@ -1,16 +0,0 @@ -Index: e2fsprogs-1.39-my-patches-from-ted/lib/ext2fs/getsize.c -=================================================================== ---- e2fsprogs-1.39-my-patches-from-ted.orig/lib/ext2fs/getsize.c -+++ e2fsprogs-1.39-my-patches-from-ted/lib/ext2fs/getsize.c -@@ -250,6 +250,11 @@ errcode_t ext2fs_get_device_size(const c - if (fstat(fd, &st) == 0) - #endif - if (S_ISREG(st.st_mode)) { -+ if ((sizeof(*retblocks) < sizeof(unsigned long long)) && -+ ((st.st_size / blocksize) > 0xFFFFFFFF)) { -+ rc = EFBIG; -+ goto out; -+ } - *retblocks = st.st_size / blocksize; - goto out; - } diff --git a/e2fsprogs-1.39-leak.patch b/e2fsprogs-1.39-leak.patch deleted file mode 100644 index d4ecbb4..0000000 --- a/e2fsprogs-1.39-leak.patch +++ /dev/null @@ -1,16 +0,0 @@ ---- e2fsprogs-1.39/lib/blkid/probe.c.leak 2006-09-05 15:41:13.000000000 -0400 -+++ e2fsprogs-1.39/lib/blkid/probe.c 2006-09-05 15:40:19.000000000 -0400 -@@ -884,7 +884,12 @@ - } - - if (!dev->bid_type) { -- if (probe.fd >= 0) close(probe.fd); -+ if (probe.fd >= 0) -+ close(probe.fd); -+ if (probe.sbbuf) -+ free(probe.sbbuf); -+ if (probe.buf) -+ free(probe.buf); - blkid_free_dev(dev); - return NULL; - } diff --git a/e2fsprogs-1.39-logdump-symlinks.patch b/e2fsprogs-1.39-logdump-symlinks.patch deleted file mode 100644 index eac4711..0000000 --- a/e2fsprogs-1.39-logdump-symlinks.patch +++ /dev/null @@ -1,49 +0,0 @@ -# HG changeset patch -# User tytso@mit.edu -# Date 1159151618 14400 -# Node ID 6ded68c87fd5e19be3a43ced60477d96b87cbae0 -# Parent d39ab0d5fde2da82c7de72a536c9bd635d372836 -blkid_devno_to_devname(): Avoid recursive loops due to symlinks in /dev - -Signed-off-by: "Theodore Ts'o" - -Index: e2fsprogs-1.39-RHEL5/lib/blkid/ChangeLog -=================================================================== ---- e2fsprogs-1.39-RHEL5.orig/lib/blkid/ChangeLog -+++ e2fsprogs-1.39-RHEL5/lib/blkid/ChangeLog -@@ -2,6 +2,11 @@ - - * read.c (parse_dev): Fix memory leak on error path. - -+2006-09-24 Theodore Tso -+ -+ * devno.c (scan_dir): Don't follow symlinks when recursively -+ searching directories under /dev. -+ - 2006-09-17 Karel Zak - - * probe.c (probe_fat): Fix problem with empty FAT label. -Index: e2fsprogs-1.39-RHEL5/lib/blkid/devno.c -=================================================================== ---- e2fsprogs-1.39-RHEL5.orig/lib/blkid/devno.c -+++ e2fsprogs-1.39-RHEL5/lib/blkid/devno.c -@@ -120,15 +120,16 @@ static void scan_dir(char *dirname, dev_ - if (stat(path, &st) < 0) - continue; - -- if (S_ISDIR(st.st_mode)) -- add_to_dirlist(path, list); -- else if (S_ISBLK(st.st_mode) && st.st_rdev == devno) { -+ if (S_ISBLK(st.st_mode) && st.st_rdev == devno) { - *devname = blkid_strdup(path); - DBG(DEBUG_DEVNO, - printf("found 0x%llx at %s (%p)\n", devno, - path, *devname)); - break; - } -+ if (S_ISDIR(st.st_mode) && !lstat(path, &st) && -+ S_ISDIR(st.st_mode)) -+ add_to_dirlist(path, list); - } - closedir(dir); - return; diff --git a/e2fsprogs-1.39-lsdel-segfault.patch b/e2fsprogs-1.39-lsdel-segfault.patch deleted file mode 100644 index f9873af..0000000 --- a/e2fsprogs-1.39-lsdel-segfault.patch +++ /dev/null @@ -1,52 +0,0 @@ -# HG changeset patch -# User tytso@mit.edu -# Date 1156885376 14400 -# Node ID 78dd5824848b223988f2d8531c7dbbf068bc255e -# Parent 712ade33bdf31b709d4796721bfa0f458f858a24 -Fix debugfs coredump when lsdel is run without an open filesystem - -Addresses Debian Bug: #378335 - -Signed-off-by: "Theodore Ts'o" ---- a/debugfs/ChangeLog Sat Aug 19 21:16:17 2006 -0400 -+++ b/debugfs/ChangeLog Tue Aug 29 17:02:56 2006 -0400 -@@ -28,6 +28,12 @@ - - * htree.c (htree_dump_int_node): Fix printf formats. - -+2006-08-29 Theodore Tso -+ -+ * lsdel.c (do_lsdel): Fix core-dumping bug. Don't depend on -+ current_fs being non-NULL until after the call to -+ common_args_process(). (Addresses Debian Bug: #378335) -+ - 2006-05-29 Theodore Tso - - * util.c (reset_getopt): In order to support ancient Linux header -Index: e2fsprogs-1.39-RHEL5/debugfs/lsdel.c -=================================================================== ---- e2fsprogs-1.39-RHEL5.orig/debugfs/lsdel.c -+++ e2fsprogs-1.39-RHEL5/debugfs/lsdel.c -@@ -81,12 +81,13 @@ void do_lsdel(int argc, char **argv) - int i; - long secs = 0; - char *tmp; -- time_t now = current_fs->now ? current_fs->now : time(0); -+ time_t now; - FILE *out; - - if (common_args_process(argc, argv, 1, 2, "ls_deleted_inodes", - "[secs]", 0)) - return; -+ - if (argc > 1) { - secs = strtol(argv[1],&tmp,0); - if (*tmp) { -@@ -95,6 +96,7 @@ void do_lsdel(int argc, char **argv) - } - } - -+ now = current_fs->now ? current_fs->now : time(0); - max_delarray = 100; - num_delarray = 0; - delarray = malloc(max_delarray * sizeof(struct deleted_info)); diff --git a/e2fsprogs-1.39-more_rounding_overflows.patch b/e2fsprogs-1.39-more_rounding_overflows.patch deleted file mode 100644 index 3edf385..0000000 --- a/e2fsprogs-1.39-more_rounding_overflows.patch +++ /dev/null @@ -1,106 +0,0 @@ -# HG changeset patch -# User tytso@mit.edu -# Date Tue Sep 12 14:56:18 2006 -0400 -# Node ID 8be686f713b52a3fa0b5dab70980ea3ddbad27b5 -# parent: 7e1e8751d2be27716166e88453b52273b7096039 -Fix more rounding overflows for filesystems that have 2**32-1 blocks - -Signed-off-by: Eric Sandeen - -Index: e2fsprogs-1.39-my-patches-from-ted/e2fsck/ChangeLog -=================================================================== ---- e2fsprogs-1.39-my-patches-from-ted.orig/e2fsck/ChangeLog -+++ e2fsprogs-1.39-my-patches-from-ted/e2fsck/ChangeLog -@@ -1,5 +1,9 @@ - 2006-08-30 Eric Sandeen - -+ * pass1.c (handle_bad_fs_blocks): use blk_t, not int for first_block. -+ -+2006-08-30 Eric Sandeen -+ - * pass1.c (new_table_block, handle_fs_bad_blocks): - * super.c (check_super_block): - Use new inlines to calculate group first & last blocks. -Index: e2fsprogs-1.39-my-patches-from-ted/e2fsck/pass1.c -=================================================================== ---- e2fsprogs-1.39-my-patches-from-ted.orig/e2fsck/pass1.c -+++ e2fsprogs-1.39-my-patches-from-ted/e2fsck/pass1.c -@@ -1953,7 +1953,7 @@ static void handle_fs_bad_blocks(e2fsck_ - { - ext2_filsys fs = ctx->fs; - dgrp_t i; -- int first_block; -+ blk_t first_block; - - for (i = 0; i < fs->group_desc_count; i++) { - first_block = ext2fs_group_first_block(fs, i); -Index: e2fsprogs-1.39-my-patches-from-ted/misc/ChangeLog -=================================================================== ---- e2fsprogs-1.39-my-patches-from-ted.orig/misc/ChangeLog -+++ e2fsprogs-1.39-my-patches-from-ted/misc/ChangeLog -@@ -1,5 +1,9 @@ - 2006-08-30 Eric Sandeen - -+ * mke2fs.c (PRS): Avoid overflow in megs calculation. -+ -+2006-08-30 Eric Sandeen -+ - * dumpe2fs.c (list_desc): Use new inlines to calculate group - first & last blocks. - -Index: e2fsprogs-1.39-my-patches-from-ted/misc/mke2fs.c -=================================================================== ---- e2fsprogs-1.39-my-patches-from-ted.orig/misc/mke2fs.c -+++ e2fsprogs-1.39-my-patches-from-ted/misc/mke2fs.c -@@ -1261,7 +1261,7 @@ static void PRS(int argc, char *argv[]) - } - - if (!fs_type) { -- int megs = fs_param.s_blocks_count * -+ int megs = (__u64)fs_param.s_blocks_count * - (EXT2_BLOCK_SIZE(&fs_param) / 1024) / 1024; - - if (megs <= 3) -Index: e2fsprogs-1.39-my-patches-from-ted/resize/ChangeLog -=================================================================== ---- e2fsprogs-1.39-my-patches-from-ted.orig/resize/ChangeLog -+++ e2fsprogs-1.39-my-patches-from-ted/resize/ChangeLog -@@ -1,5 +1,11 @@ - 2006-08-30 Eric Sandeen - -+ * online.c (online_resize_fs): use div_ceil for r_frac calculation. -+ * resize2fs.c (adjust_fs_info): avoid overflow in blk calculation -+ when figuring new reserved blocks count. -+ -+2006-08-30 Eric Sandeen -+ - * resize2fs.c (adjust_fs_info): Disallow > 2^32 indoes at resize time. - - 2006-08-30 Eric Sandeen -Index: e2fsprogs-1.39-my-patches-from-ted/resize/online.c -=================================================================== ---- e2fsprogs-1.39-my-patches-from-ted.orig/resize/online.c -+++ e2fsprogs-1.39-my-patches-from-ted/resize/online.c -@@ -59,8 +59,7 @@ errcode_t online_resize_fs(ext2_filsys f - exit(1); - } - -- r_frac = ((100 * sb->s_r_blocks_count) + sb->s_blocks_count-1) / -- sb->s_blocks_count; -+ r_frac = ext2fs_div_ceil(100 * sb->s_r_blocks_count, sb->s_blocks_count); - - retval = ext2fs_read_bitmaps(fs); - if (retval) -Index: e2fsprogs-1.39-my-patches-from-ted/resize/resize2fs.c -=================================================================== ---- e2fsprogs-1.39-my-patches-from-ted.orig/resize/resize2fs.c -+++ e2fsprogs-1.39-my-patches-from-ted/resize/resize2fs.c -@@ -250,7 +250,7 @@ retry: - /* - * Adjust the number of reserved blocks - */ -- blk = old_fs->super->s_r_blocks_count * 100 / -+ blk = (__u64)old_fs->super->s_r_blocks_count * 100 / - old_fs->super->s_blocks_count; - fs->super->s_r_blocks_count = e2p_percent(blk, - fs->super->s_blocks_count); diff --git a/e2fsprogs-1.39-save-backup-sbs.patch b/e2fsprogs-1.39-save-backup-sbs.patch deleted file mode 100644 index e5d89c3..0000000 --- a/e2fsprogs-1.39-save-backup-sbs.patch +++ /dev/null @@ -1,173 +0,0 @@ -# HG changeset patch -# User tytso@mit.edu -# Date 1182205610 14400 -# Node ID 5c00c21991974cc750efa2474fab484b0a1f1522 -# Parent 449d075befe0e4be32cce9d34ca1f03575e292d2 -Don't write changes to the backup superblocks by default - -This patch changes ext2fs_open() to set EXT2_FLAG_MASTER_SB_ONLY by -default. This avoids some problems in e2fsck (reported by Jim Garlick) -where a corrupt journal can end up writing the bad superblock to the -backups. In general, only e2fsck (after the filesystem is clean), -tune2fs, and resize2fs should change the backup superblocks by default. -Most callers of ext2fs_open() should not be touching anything where the -backups should be touched. So let's change the defaults to avoid -potential problems. - -Signed-off-by: "Theodore Ts'o" - -Index: e2fsprogs-1.39-RHEL5/e2fsck/ChangeLog -=================================================================== ---- e2fsprogs-1.39-RHEL5.orig/e2fsck/ChangeLog -+++ e2fsprogs-1.39-RHEL5/e2fsck/ChangeLog -@@ -1,3 +1,10 @@ -+2007-06-18 Theodore Tso -+ -+ * journal.c (e2fsck_run_ext3_journal), unix.c (main): Explicitly -+ add the EXT2_FLAG_MASTER_SB_ONLY flag to make sure we -+ won't write out the backup superblocks until we're sure -+ that we want write them out. -+ - 2007-03-28 Theodore Tso - - * pass1.c (e2fsck_pass1, check_ext_attr), -Index: e2fsprogs-1.39-RHEL5/e2fsck/journal.c -=================================================================== ---- e2fsprogs-1.39-RHEL5.orig/e2fsck/journal.c -+++ e2fsprogs-1.39-RHEL5/e2fsck/journal.c -@@ -832,6 +832,7 @@ int e2fsck_run_ext3_journal(e2fsck_t ctx - } - ctx->fs->priv_data = ctx; - ctx->fs->now = ctx->now; -+ ctx->fs->flags |= EXT2_FLAG_MASTER_SB_ONLY; - - /* Set the superblock flags */ - e2fsck_clear_recover(ctx, recover_retval); -Index: e2fsprogs-1.39-RHEL5/e2fsck/unix.c -=================================================================== ---- e2fsprogs-1.39-RHEL5.orig/e2fsck/unix.c -+++ e2fsprogs-1.39-RHEL5/e2fsck/unix.c -@@ -978,6 +978,19 @@ restart: - fix_problem(ctx, PR_0_SB_CORRUPT, &pctx); - fatal_error(ctx, 0); - } -+ /* -+ * We only update the master superblock because (a) paranoia; -+ * we don't want to corrupt the backup superblocks, and (b) we -+ * don't need to update the mount count and last checked -+ * fields in the backup superblock (the kernel doesn't update -+ * the backup superblocks anyway). With newer versions of the -+ * library this flag is set by ext2fs_open2(), but we set this -+ * here just to be sure. (No, we don't support e2fsck running -+ * with some other libext2fs than the one that it was shipped -+ * with, but just in case....) -+ */ -+ fs->flags |= EXT2_FLAG_MASTER_SB_ONLY; -+ - ctx->fs = fs; - fs->priv_data = ctx; - fs->now = ctx->now; -@@ -989,7 +1002,6 @@ restart: - get_newer: - fatal_error(ctx, _("Get a newer version of e2fsck!")); - } -- - /* - * Set the device name, which is used whenever we print error - * or informational messages to the user. -@@ -1088,15 +1100,6 @@ restart: - !(ctx->options & E2F_OPT_READONLY)) - ext2fs_mark_super_dirty(fs); - -- /* -- * We only update the master superblock because (a) paranoia; -- * we don't want to corrupt the backup superblocks, and (b) we -- * don't need to update the mount count and last checked -- * fields in the backup superblock (the kernel doesn't -- * update the backup superblocks anyway). -- */ -- fs->flags |= EXT2_FLAG_MASTER_SB_ONLY; -- - ehandler_init(fs->io); - - if (ctx->superblock) -Index: e2fsprogs-1.39-RHEL5/lib/ext2fs/ChangeLog -=================================================================== ---- e2fsprogs-1.39-RHEL5.orig/lib/ext2fs/ChangeLog -+++ e2fsprogs-1.39-RHEL5/lib/ext2fs/ChangeLog -@@ -1,3 +1,10 @@ -+2007-06-12 Theodore Tso -+ -+ * openfs.c (ext2fs_open2): We now set EXT2_FLAG_MASTER_SB_ONLY -+ when we open a filesystem. Applications that want to -+ write changes to the backup superblocks need to explicitly -+ clear this flag. -+ - 2007-03-21 Theodore Tso - - * imager.c (ext2fs_image_inode_write), inode.c -Index: e2fsprogs-1.39-RHEL5/lib/ext2fs/openfs.c -=================================================================== ---- e2fsprogs-1.39-RHEL5.orig/lib/ext2fs/openfs.c -+++ e2fsprogs-1.39-RHEL5/lib/ext2fs/openfs.c -@@ -100,6 +100,8 @@ errcode_t ext2fs_open2(const char *name, - memset(fs, 0, sizeof(struct struct_ext2_filsys)); - fs->magic = EXT2_ET_MAGIC_EXT2FS_FILSYS; - fs->flags = flags; -+ /* don't overwrite sb backups unless flag is explicitly cleared */ -+ fs->flags |= EXT2_FLAG_MASTER_SB_ONLY; - fs->umask = 022; - retval = ext2fs_get_mem(strlen(name)+1, &fs->device_name); - if (retval) -Index: e2fsprogs-1.39-RHEL5/misc/ChangeLog -=================================================================== ---- e2fsprogs-1.39-RHEL5.orig/misc/ChangeLog -+++ e2fsprogs-1.39-RHEL5/misc/ChangeLog -@@ -1,3 +1,9 @@ -+2007-06-12 Theodore Tso -+ -+ * tune2fs.c (main): Clear the EXT2_FLAG_MASTER_SB_ONLY flag -+ because we want tune2fs changes to get written to the -+ backup blocks. -+ - 2007-05-31 Theodore Tso - - * mke2fs.c (parse_extended_opts): Free allocated buf on return -Index: e2fsprogs-1.39-RHEL5/misc/tune2fs.c -=================================================================== ---- e2fsprogs-1.39-RHEL5.orig/misc/tune2fs.c -+++ e2fsprogs-1.39-RHEL5/misc/tune2fs.c -@@ -781,6 +781,7 @@ int main (int argc, char ** argv) - exit(1); - } - sb = fs->super; -+ fs->flags &= ~EXT2_FLAG_MASTER_SB_ONLY; - if (print_label) { - /* For e2label emulation */ - printf("%.*s\n", (int) sizeof(sb->s_volume_name), -Index: e2fsprogs-1.39-RHEL5/resize/ChangeLog -=================================================================== ---- e2fsprogs-1.39-RHEL5.orig/resize/ChangeLog -+++ e2fsprogs-1.39-RHEL5/resize/ChangeLog -@@ -1,3 +1,9 @@ -+2007-06-12 Theodore Tso -+ -+ * resize2fs.c (resize_fs): Clear the EXT2_FLAG_MASTER_SB_ONLY flag -+ to make sure the superblock changes are written out to the -+ backup superblocks. -+ - 2007-03-18 Theodore Tso - - * resize2fs.c (check_and_change_inodes): Check to make sure the -Index: e2fsprogs-1.39-RHEL5/resize/resize2fs.c -=================================================================== ---- e2fsprogs-1.39-RHEL5.orig/resize/resize2fs.c -+++ e2fsprogs-1.39-RHEL5/resize/resize2fs.c -@@ -138,6 +138,7 @@ errcode_t resize_fs(ext2_filsys fs, blk_ - if (retval) - goto errout; - -+ rfs->new_fs->flags &= ~EXT2_FLAG_MASTER_SB_ONLY; - retval = ext2fs_close(rfs->new_fs); - if (retval) - goto errout; diff --git a/e2fsprogs-1.39-symlink-byteswap.patch b/e2fsprogs-1.39-symlink-byteswap.patch deleted file mode 100644 index f86d75b..0000000 --- a/e2fsprogs-1.39-symlink-byteswap.patch +++ /dev/null @@ -1,111 +0,0 @@ -# HG changeset patch -# User tytso@mit.edu -# Date 1176573631 14400 -# Node ID aa8d65921c8922dfed73dd05027a097cc5946653 -# Parent 4b2e34b5f7506f9f74b3fadf79280316d57e47d5 -Correct byteswapping for fast symlinks with xattrs - -Fix a problem byte-swapping fast symlinks inodes that contain extended -attributes. - -Addresses Red Hat Bugzilla: #232663 -Addresses LTC Bugzilla: #27634 - -Signed-off-by: "Bryn M. Reeves" -Signed-off-by: "Theodore Ts'o" - -Index: e2fsprogs-1.39-RHEL5/e2fsck/ChangeLog -=================================================================== ---- e2fsprogs-1.39-RHEL5.orig/e2fsck/ChangeLog -+++ e2fsprogs-1.39-RHEL5/e2fsck/ChangeLog -@@ -5,6 +5,14 @@ - won't write out the backup superblocks until we're sure - that we want write them out. - -+2007-04-14 Theodore Tso -+ -+ * pass2.c (e2fsck_process_bad_inode): Remove special kludge that -+ dealt with long symlinks on big endian systems. It turns -+ out this was a workaround to a bug described in Red Hat -+ Bugzilla #232663, with an odd twist. See comment #12 for -+ more details. -+ - 2007-03-28 Theodore Tso - - * pass1.c (e2fsck_pass1, check_ext_attr), -Index: e2fsprogs-1.39-RHEL5/e2fsck/pass2.c -=================================================================== ---- e2fsprogs-1.39-RHEL5.orig/e2fsck/pass2.c -+++ e2fsprogs-1.39-RHEL5/e2fsck/pass2.c -@@ -1187,22 +1187,6 @@ extern int e2fsck_process_bad_inode(e2fs - !(fs->super->s_feature_compat & EXT2_FEATURE_COMPAT_EXT_ATTR)) { - if (fix_problem(ctx, PR_2_FILE_ACL_ZERO, &pctx)) { - inode.i_file_acl = 0; --#ifdef EXT2FS_ENABLE_SWAPFS -- /* -- * This is a special kludge to deal with long -- * symlinks on big endian systems. i_blocks -- * had already been decremented earlier in -- * pass 1, but since i_file_acl hadn't yet -- * been cleared, ext2fs_read_inode() assumed -- * that the file was short symlink and would -- * not have byte swapped i_block[0]. Hence, -- * we have to byte-swap it here. -- */ -- if (LINUX_S_ISLNK(inode.i_mode) && -- (fs->flags & EXT2_FLAG_SWAP_BYTES) && -- (inode.i_blocks == fs->blocksize >> 9)) -- inode.i_block[0] = ext2fs_swab32(inode.i_block[0]); --#endif - inode_modified++; - } else - not_fixed++; -Index: e2fsprogs-1.39-RHEL5/lib/ext2fs/swapfs.c -=================================================================== ---- e2fsprogs-1.39-RHEL5.orig/lib/ext2fs/swapfs.c -+++ e2fsprogs-1.39-RHEL5/lib/ext2fs/swapfs.c -@@ -124,7 +124,7 @@ void ext2fs_swap_inode_full(ext2_filsys - struct ext2_inode_large *f, int hostorder, - int bufsize) - { -- unsigned i; -+ unsigned i, has_data_blocks; - int islnk = 0; - __u32 *eaf, *eat; - -@@ -141,11 +141,17 @@ void ext2fs_swap_inode_full(ext2_filsys - t->i_dtime = ext2fs_swab32(f->i_dtime); - t->i_gid = ext2fs_swab16(f->i_gid); - t->i_links_count = ext2fs_swab16(f->i_links_count); -+ if (hostorder) -+ has_data_blocks = ext2fs_inode_data_blocks(fs, -+ (struct ext2_inode *) f); - t->i_blocks = ext2fs_swab32(f->i_blocks); -+ if (!hostorder) -+ has_data_blocks = ext2fs_inode_data_blocks(fs, -+ (struct ext2_inode *) t); - t->i_flags = ext2fs_swab32(f->i_flags); - t->i_file_acl = ext2fs_swab32(f->i_file_acl); - t->i_dir_acl = ext2fs_swab32(f->i_dir_acl); -- if (!islnk || ext2fs_inode_data_blocks(fs, (struct ext2_inode *)t)) { -+ if (!islnk || has_data_blocks ) { - for (i = 0; i < EXT2_N_BLOCKS; i++) - t->i_block[i] = ext2fs_swab32(f->i_block[i]); - } else if (t != f) { -Index: e2fsprogs-1.39-RHEL5/lib/ext2fs/ChangeLog -=================================================================== ---- e2fsprogs-1.39-RHEL5.orig/lib/ext2fs/ChangeLog -+++ e2fsprogs-1.39-RHEL5/lib/ext2fs/ChangeLog -@@ -5,6 +5,12 @@ - write changes to the backup superblocks need to explicitly - clear this flag. - -+2007-04-14 Theodore Tso -+ -+ * swapfs.c (ext2fs_swap_inode_full): Fix a problem byte-swapping -+ fast symlinks inodes that contain extended attributes. -+ (Addresses Red Hat Bugzilla #232663, LTC bugzilla #27634) -+ - 2007-03-21 Theodore Tso - - * imager.c (ext2fs_image_inode_write), inode.c diff --git a/e2fsprogs-1.39-unused_group_blocks.patch b/e2fsprogs-1.39-unused_group_blocks.patch deleted file mode 100644 index 3a6b27a..0000000 --- a/e2fsprogs-1.39-unused_group_blocks.patch +++ /dev/null @@ -1,182 +0,0 @@ -# HG changeset patch -# User tytso@mit.edu -# Date Tue Sep 12 14:56:12 2006 -0400 -# Node ID 59bf36fb8344bb7a3971af7df22d41f8d8b14610 -# parent: 90cd01f7fcd6293846f0b3ca6ce2b007e3dd7d51 -Remove unused variables - -Signed-off-by: Eric Sandeen - -Index: e2fsprogs-1.39-my-patches-from-ted/e2fsck/ChangeLog -=================================================================== ---- e2fsprogs-1.39-my-patches-from-ted.orig/e2fsck/ChangeLog -+++ e2fsprogs-1.39-my-patches-from-ted/e2fsck/ChangeLog -@@ -1,5 +1,9 @@ - 2006-08-30 Eric Sandeen - -+ * pass1.c (handle_fs_bad_blocks): Remove unused variables. -+ -+2006-08-30 Eric Sandeen -+ - * pass1b.c (check_if_fs_block): Change block group loop to use - a common pattern of first_block/last_block, etc. - -Index: e2fsprogs-1.39-my-patches-from-ted/e2fsck/pass1.c -=================================================================== ---- e2fsprogs-1.39-my-patches-from-ted.orig/e2fsck/pass1.c -+++ e2fsprogs-1.39-my-patches-from-ted/e2fsck/pass1.c -@@ -1981,14 +1981,13 @@ static void handle_fs_bad_blocks(e2fsck_ - static void mark_table_blocks(e2fsck_t ctx) - { - ext2_filsys fs = ctx->fs; -- blk_t block, b; -+ blk_t b; - dgrp_t i; - int j; - struct problem_context pctx; - - clear_problem_context(&pctx); - -- block = fs->super->s_first_data_block; - for (i = 0; i < fs->group_desc_count; i++) { - pctx.group = i; - -@@ -2049,7 +2048,6 @@ static void mark_table_blocks(e2fsck_t c - fs->group_desc[i].bg_inode_bitmap); - } - } -- block += fs->super->s_blocks_per_group; - } - } - -Index: e2fsprogs-1.39-my-patches-from-ted/lib/ext2fs/ChangeLog -=================================================================== ---- e2fsprogs-1.39-my-patches-from-ted.orig/lib/ext2fs/ChangeLog -+++ e2fsprogs-1.39-my-patches-from-ted/lib/ext2fs/ChangeLog -@@ -1,5 +1,10 @@ - 2006-08-30 Eric Sandeen - -+ * closefs.c (write_backup_super): -+ * initialize.c (ext2fs_initialize): Remove unused variables. -+ -+2006-08-30 Eric Sandeen -+ - * check_desc.c (ext2fs_check_desc): avoid overflows when iterating - over group descriptors on very large filesystems. - -Index: e2fsprogs-1.39-my-patches-from-ted/lib/ext2fs/closefs.c -=================================================================== ---- e2fsprogs-1.39-my-patches-from-ted.orig/lib/ext2fs/closefs.c -+++ e2fsprogs-1.39-my-patches-from-ted/lib/ext2fs/closefs.c -@@ -206,7 +206,6 @@ static errcode_t write_backup_super(ext2 - errcode_t ext2fs_flush(ext2_filsys fs) - { - dgrp_t i,j; -- blk_t group_block; - errcode_t retval; - unsigned long fs_state; - struct ext2_super_block *super_shadow = 0; -@@ -275,7 +274,6 @@ errcode_t ext2fs_flush(ext2_filsys fs) - * Write out the master group descriptors, and the backup - * superblocks and group descriptors. - */ -- group_block = fs->super->s_first_data_block; - group_ptr = (char *) group_shadow; - if (fs->super->s_feature_incompat & EXT2_FEATURE_INCOMPAT_META_BG) - old_desc_blocks = fs->super->s_first_meta_bg; -Index: e2fsprogs-1.39-my-patches-from-ted/lib/ext2fs/initialize.c -=================================================================== ---- e2fsprogs-1.39-my-patches-from-ted.orig/lib/ext2fs/initialize.c -+++ e2fsprogs-1.39-my-patches-from-ted/lib/ext2fs/initialize.c -@@ -99,7 +99,6 @@ errcode_t ext2fs_initialize(const char * - int frags_per_block; - unsigned int rem; - unsigned int overhead = 0; -- blk_t group_block; - unsigned int ipg; - dgrp_t i; - blk_t numblocks; -@@ -360,7 +359,6 @@ retry: - * inode table have not been allocated (and in fact won't be - * by this routine), they are accounted for nevertheless. - */ -- group_block = super->s_first_data_block; - super->s_free_blocks_count = 0; - for (i = 0; i < fs->group_desc_count; i++) { - numblocks = ext2fs_reserve_super_and_bgd(fs, i, fs->block_map); -@@ -370,8 +368,6 @@ retry: - fs->group_desc[i].bg_free_inodes_count = - fs->super->s_inodes_per_group; - fs->group_desc[i].bg_used_dirs_count = 0; -- -- group_block += super->s_blocks_per_group; - } - - ext2fs_mark_super_dirty(fs); -Index: e2fsprogs-1.39-my-patches-from-ted/misc/ChangeLog -=================================================================== ---- e2fsprogs-1.39-my-patches-from-ted.orig/misc/ChangeLog -+++ e2fsprogs-1.39-my-patches-from-ted/misc/ChangeLog -@@ -1,5 +1,10 @@ - 2006-08-30 Eric Sandeen - -+ * e2image.c (mark_table_blocks): Remove unused first_block -+ incrementing from loop. -+ -+2006-08-30 Eric Sandeen -+ - * dumpe2fs.c (list_desc, mark_table_blocks): Avoid overflows when - iterating over group descriptors on very large - filesystems. -Index: e2fsprogs-1.39-my-patches-from-ted/misc/e2image.c -=================================================================== ---- e2fsprogs-1.39-my-patches-from-ted.orig/misc/e2image.c -+++ e2fsprogs-1.39-my-patches-from-ted/misc/e2image.c -@@ -287,7 +287,6 @@ static void mark_table_blocks(ext2_filsy - ext2fs_mark_block_bitmap(meta_block_map, - fs->group_desc[i].bg_inode_bitmap); - } -- first_block += fs->super->s_blocks_per_group; - } - } - -Index: e2fsprogs-1.39-my-patches-from-ted/resize/ChangeLog -=================================================================== ---- e2fsprogs-1.39-my-patches-from-ted.orig/resize/ChangeLog -+++ e2fsprogs-1.39-my-patches-from-ted/resize/ChangeLog -@@ -1,3 +1,7 @@ -+2006-08-30 Eric Sandeen -+ -+ * resize2fs.c (mark_table_blocks): Remove unused variable. -+ - 2006-08-30 Theodore Tso - - * resize2fs.c (adjust_fs_info), online.c (online_resize_fs): Use -Index: e2fsprogs-1.39-my-patches-from-ted/resize/resize2fs.c -=================================================================== ---- e2fsprogs-1.39-my-patches-from-ted.orig/resize/resize2fs.c -+++ e2fsprogs-1.39-my-patches-from-ted/resize/resize2fs.c -@@ -536,14 +536,13 @@ errout: - static errcode_t mark_table_blocks(ext2_filsys fs, - ext2fs_block_bitmap bmap) - { -- blk_t block, b; -+ blk_t b; - unsigned int j; - dgrp_t i; - unsigned long meta_bg_size; - unsigned int old_desc_blocks; - - meta_bg_size = (fs->blocksize / sizeof (struct ext2_group_desc)); -- block = fs->super->s_first_data_block; - if (fs->super->s_feature_incompat & EXT2_FEATURE_INCOMPAT_META_BG) - old_desc_blocks = fs->super->s_first_meta_bg; - else -@@ -571,7 +570,6 @@ static errcode_t mark_table_blocks(ext2_ - */ - ext2fs_mark_block_bitmap(bmap, - fs->group_desc[i].bg_inode_bitmap); -- block += fs->super->s_blocks_per_group; - } - return 0; - } diff --git a/e2fsprogs-1.39-uuid.patch b/e2fsprogs-1.39-uuid.patch deleted file mode 100644 index ee8026e..0000000 --- a/e2fsprogs-1.39-uuid.patch +++ /dev/null @@ -1,121 +0,0 @@ -# HG changeset patch -# User tytso@mit.edu -# Date Sun Oct 22 00:18:49 2006 -0400 -# Node ID 91cc4c459889b6013c832477742dc80274cca2e3 -# parent: fa7a505b350d10ab97de18f5caeef0a8493dba94 -Add failsafe against duplicate UUID's generated by threaded programs - -Add in randomness based on Linux's thread id (gettid) to avoid race -conditions when two threads try to generate uuid's at the same time. -This shouldn't be an issue if /dev/urandom has proper locking and is -present, so this is just a failsafe. - -Addresses SourceForge Bug: #1529672 - -Signed-off-by: "Theodore Ts'o" - ---- a/ChangeLog Sun Oct 22 00:14:26 2006 -0400 -+++ b/ChangeLog Sun Oct 22 00:18:49 2006 -0400 -@@ -0,0 +1,4 @@ -+2006-10-22 Theodore Tso -+ -+ * configure, configure.in: Add test for jrand48() -+ ---- a/configure Sun Oct 22 00:14:26 2006 -0400 -+++ b/configure Sun Oct 22 00:18:49 2006 -0400 -@@ -16306,7 +16306,8 @@ - - - --for ac_func in chflags getrusage llseek lseek64 open64 fstat64 getmntinfo strtoull strcasecmp srandom fchown mallinfo fdatasync strnlen strptime sysconf pathconf posix_memalign memalign valloc __secure_getenv prctl -+ -+for ac_func in chflags getrusage llseek lseek64 open64 fstat64 getmntinfo strtoull strcasecmp srandom jrand48 fchown mallinfo fdatasync strnlen strptime sysconf pathconf posix_memalign memalign valloc __secure_getenv prctl - do - as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` - { echo "$as_me:$LINENO: checking for $ac_func" >&5 ---- a/configure.in Sun Oct 22 00:14:26 2006 -0400 -+++ b/configure.in Sun Oct 22 00:18:49 2006 -0400 -@@ -659,7 +659,7 @@ - [#include - #include ]) - dnl --AC_CHECK_FUNCS(chflags getrusage llseek lseek64 open64 fstat64 getmntinfo strtoull strcasecmp srandom fchown mallinfo fdatasync strnlen strptime sysconf pathconf posix_memalign memalign valloc __secure_getenv prctl) -+AC_CHECK_FUNCS(chflags getrusage llseek lseek64 open64 fstat64 getmntinfo strtoull strcasecmp srandom jrand48 fchown mallinfo fdatasync strnlen strptime sysconf pathconf posix_memalign memalign valloc __secure_getenv prctl) - dnl - dnl Check to see if -lsocket is required (solaris) to make something - dnl that uses socket() to compile; this is needed for the UUID library ---- a/lib/uuid/ChangeLog Sun Oct 22 00:14:26 2006 -0400 -+++ b/lib/uuid/ChangeLog Sun Oct 22 00:18:49 2006 -0400 -@@ -1,3 +1,12 @@ -+2006-10-22 Theodore Tso -+ -+ * gen_uuid.c (get_random_bytes): Add in randomness based on -+ Linux's thread id (gettid) to avoid race conditions when -+ two threads try to generate uuid's at the same time. This -+ shouldn't be an issue if /dev/urandom has proper locking -+ and is present, so this is just a failsafe. (Addresses -+ SourceForge Bug: #1529672) -+ - 2006-01-06 Theodore Ts'o - - * gen_uuid.c (get_random_fd): Set the FD_CLOEXEC flag on the file ---- a/lib/uuid/gen_uuid.c Sun Oct 22 00:14:26 2006 -0400 -+++ b/lib/uuid/gen_uuid.c Sun Oct 22 00:18:49 2006 -0400 -@@ -69,12 +69,20 @@ - #ifdef HAVE_NET_IF_DL_H - #include - #endif -+#ifdef __linux__ -+#include -+#endif - - #include "uuidP.h" - - #ifdef HAVE_SRANDOM - #define srand(x) srandom(x) - #define rand() random() -+#endif -+ -+#if defined(__linux__) && defined(__NR_gettid) && defined(HAVE_JRAND48) -+#define DO_JRAND_MIX -+static unsigned short jrand_seed[3]; - #endif - - static int get_random_fd(void) -@@ -94,6 +102,11 @@ - fcntl(fd, F_SETFD, i | FD_CLOEXEC); - } - srand((getpid() << 16) ^ getuid() ^ tv.tv_sec ^ tv.tv_usec); -+#ifdef DO_JRAND_MIX -+ jrand_seed[0] = getpid() ^ (tv.tv_sec & 0xFFFF); -+ jrand_seed[1] = getppid() ^ (tv.tv_usec & 0xFFFF); -+ jrand_seed[2] = (tv.tv_sec ^ tv.tv_usec) >> 16; -+#endif - } - /* Crank the random number generator a few times */ - gettimeofday(&tv, 0); -@@ -112,6 +125,7 @@ - int i, n = nbytes, fd = get_random_fd(); - int lose_counter = 0; - unsigned char *cp = (unsigned char *) buf; -+ unsigned short tmp_seed[3]; - - if (fd >= 0) { - while (n > 0) { -@@ -133,6 +147,15 @@ - */ - for (cp = buf, i = 0; i < nbytes; i++) - *cp++ ^= (rand() >> 7) & 0xFF; -+#ifdef DO_JRAND_MIX -+ memcpy(tmp_seed, jrand_seed, sizeof(tmp_seed)); -+ jrand_seed[2] = jrand_seed[2] ^ syscall(__NR_gettid); -+ for (cp = buf, i = 0; i < nbytes; i++) -+ *cp++ ^= (jrand48(tmp_seed) >> 7) & 0xFF; -+ memcpy(jrand_seed, tmp_seed, -+ sizeof(jrand_seed)-sizeof(unsigned short)); -+#endif -+ - return; - } - - diff --git a/e2fsprogs-1.39-xattr-sanity.patch b/e2fsprogs-1.39-xattr-sanity.patch deleted file mode 100644 index fed78ec..0000000 --- a/e2fsprogs-1.39-xattr-sanity.patch +++ /dev/null @@ -1,49 +0,0 @@ -# HG changeset patch -# User tytso@mit.edu -# Date 1182493358 14400 -# Node ID 702632e66380e459f60b238570edd1e911dd46bc -# Parent 17c2ad1542e716779e127b5db35879c391ac6282 -e2fsck: added sanity check for xattr validation - -Add an extra validity test in check_ext_attr(). If an attribute's -e_value_size is zero the current code does not allocate a region for it -and as a result the e_value_offs value is not verified. However, if -e_value_offs is very large then the later call to -ext2fs_ext_attr_hash_entry() can dereference bad memory and crash -e2fsck. - -Signed-off-by: Andreas Dilger -Signed-off-by: Jim Garlick - ---- a/e2fsck/ChangeLog Thu Jun 21 13:43:33 2007 -0400 -+++ b/e2fsck/ChangeLog Fri Jun 22 02:22:38 2007 -0400 -@@ -1,3 +1,13 @@ 2007-06-18 Theodore Tso -+ -+ * pass1.c (check_ext_attr): Adds an extra validity test in -+ check_ext_attr(). If an attribute's e_value_size is zero -+ the current code does not allocate a region for it and as -+ a result the e_value_offs value is not verified. However, -+ if e_value_offs is very large then the later call to -+ ext2fs_ext_attr_hash_entry() can dereference bad memory -+ and crash e2fsck. -+ - 2007-06-18 Theodore Tso - - * journal.c (e2fsck_run_ext3_journal), unix.c (main): Explicitly ---- a/e2fsck/pass1.c Thu Jun 21 13:43:33 2007 -0400 -+++ b/e2fsck/pass1.c Fri Jun 22 02:22:38 2007 -0400 -@@ -1380,6 +1380,11 @@ static int check_ext_attr(e2fsck_t ctx, - if (fix_problem(ctx, PR_1_EA_BAD_VALUE, pctx)) - goto clear_extattr; - } -+ if (entry->e_value_offs + entry->e_value_size > fs->blocksize) { -+ if (fix_problem(ctx, PR_1_EA_BAD_VALUE, pctx)) -+ goto clear_extattr; -+ break; -+ } - if (entry->e_value_size && - region_allocate(region, entry->e_value_offs, - EXT2_EXT_ATTR_SIZE(entry->e_value_size))) { - - diff --git a/e2fsprogs.spec b/e2fsprogs.spec index 0dc131d..b88bbb6 100644 --- a/e2fsprogs.spec +++ b/e2fsprogs.spec @@ -4,7 +4,7 @@ Summary: Utilities for managing the second and third extended (ext2/ext3) filesystems Name: e2fsprogs Version: 1.40.2 -Release: 10%{?dist} +Release: 11%{?dist} # License based on upstream-modified COPYING file, # which clearly states "V2" intent. License: GPLv2 @@ -267,6 +267,9 @@ exit 0 %{_mandir}/man3/uuid_unparse.3* %changelog +* Tue Oct 23 2007 Eric Sandeen 1.40.2-11 +- Add arm to multilib header wrapper + * Sat Oct 20 2007 Eric Sandeen 1.40.2-10 - Make (more) file timestamps match those in tarball for multilib tidiness - Fix e2fsprogs-libs summary (shared libs not static) diff --git a/ext2_types-wrapper.h b/ext2_types-wrapper.h index 847c5a4..6aade2a 100644 --- a/ext2_types-wrapper.h +++ b/ext2_types-wrapper.h @@ -19,6 +19,8 @@ #include "ext2_types-x86_64.h" #elif defined(__alpha__) #include "ext2_types-alpha.h" +#elif defined(__arm__) +#include "ext2_types-arm.h" #else #error "This e2fsprogs-devel package does not work your architecture?" #endif