e2undo: fix endian issues
PATCH 1/1 e2undo: fix endian issues
Two new e2undo issues exist in the latest release on big endian machines.
Quoted 1 line
From sparse check:
undo_io.c:157:26: warning: invalid assignment: |=
undo_io.c:157:26: left side has type restricted __le32
undo_io.c:157:26: right side has type int
undo_io.c:161:26: warning: invalid assignment: &=
undo_io.c:161:26: left side has type restricted __le32
undo_io.c:161:26: right side has type int
e2undo.c:211:16: warning: cast to restricted __le64 e2undo.c:211:16: warning: cast from restricted blk64_t e2undo.c:212:16: warning: cast to restricted __le64 e2undo.c:212:16: warning: cast from restricted blk64_t
Addresses-RedHat-Bugzilla: 1344636
---
lib/ext2fs/undo_io.c +2 -2
@@ -154,11 +154,11 @@ struct undo_private_data {#define E2UNDO_FEATURE_COMPAT_FS_OFFSET 0x1/* the filesystem offset */ static inline void e2undo_set_feature_fs_offset (struct undo_header *header) { - header->f_compat |=E2UNDO_FEATURE_COMPAT_FS_OFFSET ; + header->f_compat |=ext2fs_le32_to_cpu (E2UNDO_FEATURE_COMPAT_FS_OFFSET ); }static inline void e2undo_clear_feature_fs_offset (struct undo_header *header) { - header->f_compat &= ~E2UNDO_FEATURE_COMPAT_FS_OFFSET ; + header->f_compat &= ~ext2fs_le32_to_cpu (E2UNDO_FEATURE_COMPAT_FS_OFFSET ); }static io_manager undo_io_backing_manager;
misc/e2undo.c +1 -2
@@ -208,8 +208,7 @@ static int key_compare(const void *a, const void *b) ka = a; kb = b; -return ext2fs_le64_to_cpu (ka->fsblk) - -ext2fs_le64_to_cpu (kb->fsblk); +return ka->fsblk - kb->fsblk; }static int e2undo_setup_tdb (const char *name,io_manager *io_ptr)
Quoted 27 lines · Eric Sandeen
Two new e2undo issues exist in the latest release on big endian machines.
From sparse check:
undo_io.c:157:26: warning: invalid assignment: |=
undo_io.c:157:26: left side has type restricted__le32
undo_io.c:157:26: right side has type int
undo_io.c:161:26: warning: invalid assignment: &=
undo_io.c:161:26: left side has type restricted__le32
undo_io.c:161:26: right side has type inte2undo.c:211:16: warning: cast to restricted
__le64e2undo.c:211:16: warning: cast from restrictedblk64_te2undo.c:212:16: warning: cast to restricted__le64e2undo.c:212:16: warning: cast from restrictedblk64_tAddresses-RedHat-Bugzilla: 1344636
Signed-off-by Eric Sandeen <[email protected]>---
lib/ext2fs/undo_io.c +0
-0@@ -154,11 +154,11 @@ struct undo_private_data {#define E2UNDO_FEATURE_COMPAT_FS_OFFSET 0x1/* the filesystem offset */
lib/ext2fs/undo_io.c struct undo_private_data { · line 162
Quoted 10 lines
lib/ext2fs/undo_io.c +2
-2static inline void e2undo_set_feature_fs_offset (struct undo_header *header) { - header->f_compat |=E2UNDO_FEATURE_COMPAT_FS_OFFSET ; + header->f_compat |=ext2fs_le32_to_cpu (E2UNDO_FEATURE_COMPAT_FS_OFFSET ); }static inline void e2undo_clear_feature_fs_offset (struct undo_header *header) { - header->f_compat &= ~E2UNDO_FEATURE_COMPAT_FS_OFFSET ; + header->f_compat &= ~ext2fs_le32_to_cpu (E2UNDO_FEATURE_COMPAT_FS_OFFSET ); }
(I don't remember the fs_offset patch going to the list?)
misc/e2undo.c static int key_compare(const void *a, const void *b) · line 211
Quoted 12 lines
lib/ext2fs/undo_io.c +0
-0static io_manager undo_io_backing_manager;misc/e2undo.c +1
-2@@ -208,8 +208,7 @@ static int key_compare(const void *a, const void *b) ka = a; kb = b; -return ext2fs_le64_to_cpu (ka->fsblk) - -ext2fs_le64_to_cpu (kb->fsblk); +return ka->fsblk - kb->fsblk;
Otherwise, both changes look ok, so
--D
Quoted 8 lines
misc/e2undo.c +0
-1}static int e2undo_setup_tdb (const char *name,io_manager *io_ptr) --To unsubscribe from this list: send the line "unsubscribe linux-ext4" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 34 lines · Darrick J. Wong
Quoted 33 lines · Eric Sandeen
Two new e2undo issues exist in the latest release on big endian machines.
From sparse check:
undo_io.c:157:26: warning: invalid assignment: |=
undo_io.c:157:26: left side has type restricted__le32
undo_io.c:157:26: right side has type int
undo_io.c:161:26: warning: invalid assignment: &=
undo_io.c:161:26: left side has type restricted__le32
undo_io.c:161:26: right side has type inte2undo.c:211:16: warning: cast to restricted
__le64e2undo.c:211:16: warning: cast from restrictedblk64_te2undo.c:212:16: warning: cast to restricted__le64e2undo.c:212:16: warning: cast from restrictedblk64_tAddresses-RedHat-Bugzilla: 1344636
Signed-off-by Eric Sandeen <[email protected]>---
lib/ext2fs/undo_io.c +1
-1@@ -154,11 +154,11 @@ struct undo_private_data {#define E2UNDO_FEATURE_COMPAT_FS_OFFSET 0x1/* the filesystem offset */ static inline void e2undo_set_feature_fs_offset (struct undo_header *header) { - header->f_compat |=E2UNDO_FEATURE_COMPAT_FS_OFFSET ; + header->f_compat |=ext2fs_le32_to_cpu (E2UNDO_FEATURE_COMPAT_FS_OFFSET ); }
Quoted 7 lines
lib/ext2fs/undo_io.c struct undo_private_data { · line 162
Quoted 4 lines
lib/ext2fs/undo_io.c +1
-1static inline void e2undo_clear_feature_fs_offset (struct undo_header *header) { - header->f_compat &= ~E2UNDO_FEATURE_COMPAT_FS_OFFSET ; + header->f_compat &= ~ext2fs_le32_to_cpu (E2UNDO_FEATURE_COMPAT_FS_OFFSET ); }(I don't remember the
fs_offsetpatch going to the list?)
No, I sent it directly to Ted - but I was told to CC the list in the future. Sorry for that...
Marcus
Theodore Ts'o
AppliedQuoted 12 lines · Eric Sandeen
Two new e2undo issues exist in the latest release on big endian machines.
From sparse check:
undo_io.c:157:26: warning: invalid assignment: |=
undo_io.c:157:26: left side has type restricted__le32
undo_io.c:157:26: right side has type int
undo_io.c:161:26: warning: invalid assignment: &=
undo_io.c:161:26: left side has type restricted__le32
undo_io.c:161:26: right side has type int
Quoted 7 lines
e2undo.c:211:16: warning: cast to restricted
__le64e2undo.c:211:16: warning: cast from restrictedblk64_te2undo.c:212:16: warning: cast to restricted__le64e2undo.c:212:16: warning: cast from restrictedblk64_tAddresses-RedHat-Bugzilla: 1344636
Signed-off-by Eric Sandeen <[email protected]>
Thanks, applied.
- Ted