* [PATCH] e2undo: fix endian issues
@ 2016-06-16 22:51 Eric Sandeen
2016-06-16 23:05 ` Darrick J. Wong
2016-06-22 3:11 ` Theodore Ts'o
0 siblings, 2 replies; 4+ messages in thread
From: Eric Sandeen @ 2016-06-16 22:51 UTC (permalink / raw)
To: linux-ext4@vger.kernel.org
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
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
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
---
diff --git a/lib/ext2fs/undo_io.c b/lib/ext2fs/undo_io.c
index f921218..776d5b8 100644
--- a/lib/ext2fs/undo_io.c
+++ b/lib/ext2fs/undo_io.c
@@ -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;
diff --git a/misc/e2undo.c b/misc/e2undo.c
index a8cb000..6fb6e44 100644
--- a/misc/e2undo.c
+++ b/misc/e2undo.c
@@ -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)
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] e2undo: fix endian issues
2016-06-16 22:51 [PATCH] e2undo: fix endian issues Eric Sandeen
@ 2016-06-16 23:05 ` Darrick J. Wong
2016-06-17 7:24 ` Marcus Hüwe
2016-06-22 3:11 ` Theodore Ts'o
1 sibling, 1 reply; 4+ messages in thread
From: Darrick J. Wong @ 2016-06-16 23:05 UTC (permalink / raw)
To: Eric Sandeen; +Cc: linux-ext4@vger.kernel.org
On Thu, Jun 16, 2016 at 05:51:04PM -0500, Eric Sandeen wrote:
> 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
>
> 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
> Signed-off-by: Eric Sandeen <sandeen@redhat.com>
> ---
>
> diff --git a/lib/ext2fs/undo_io.c b/lib/ext2fs/undo_io.c
> index f921218..776d5b8 100644
> --- a/lib/ext2fs/undo_io.c
> +++ b/lib/ext2fs/undo_io.c
> @@ -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);
> }
(I don't remember the fs_offset patch going to the list?)
> static io_manager undo_io_backing_manager;
> diff --git a/misc/e2undo.c b/misc/e2undo.c
> index a8cb000..6fb6e44 100644
> --- a/misc/e2undo.c
> +++ b/misc/e2undo.c
> @@ -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
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
--D
> }
>
> 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 majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] e2undo: fix endian issues
2016-06-16 23:05 ` Darrick J. Wong
@ 2016-06-17 7:24 ` Marcus Hüwe
0 siblings, 0 replies; 4+ messages in thread
From: Marcus Hüwe @ 2016-06-17 7:24 UTC (permalink / raw)
To: Darrick J. Wong; +Cc: linux-ext4
On 2016-06-16 16:05:10 -0700, Darrick J. Wong wrote:
> On Thu, Jun 16, 2016 at 05:51:04PM -0500, Eric Sandeen wrote:
> > 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
> >
> > 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
> > Signed-off-by: Eric Sandeen <sandeen@redhat.com>
> > ---
> >
> > diff --git a/lib/ext2fs/undo_io.c b/lib/ext2fs/undo_io.c
> > index f921218..776d5b8 100644
> > --- a/lib/ext2fs/undo_io.c
> > +++ b/lib/ext2fs/undo_io.c
> > @@ -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);
> > }
>
> (I don't remember the fs_offset patch 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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] e2undo: fix endian issues
2016-06-16 22:51 [PATCH] e2undo: fix endian issues Eric Sandeen
2016-06-16 23:05 ` Darrick J. Wong
@ 2016-06-22 3:11 ` Theodore Ts'o
1 sibling, 0 replies; 4+ messages in thread
From: Theodore Ts'o @ 2016-06-22 3:11 UTC (permalink / raw)
To: Eric Sandeen; +Cc: linux-ext4@vger.kernel.org
On Thu, Jun 16, 2016 at 05:51:04PM -0500, Eric Sandeen wrote:
> 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
>
> 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
> Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Thanks, applied.
- Ted
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2016-06-22 3:38 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-06-16 22:51 [PATCH] e2undo: fix endian issues Eric Sandeen
2016-06-16 23:05 ` Darrick J. Wong
2016-06-17 7:24 ` Marcus Hüwe
2016-06-22 3:11 ` Theodore Ts'o
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).