diff options
author | Steven Whitehouse <swhiteho@redhat.com> | 2006-03-30 15:46:23 -0500 |
---|---|---|
committer | Steven Whitehouse <swhiteho@redhat.com> | 2006-03-30 15:46:23 -0500 |
commit | e3167ded1f1b16424bc14d5673cdc5414f179970 (patch) | |
tree | 1b995e6387b230b1f447aabe30b689d091ee0b52 /fs/gfs2/util.h | |
parent | cd45697f0ddbb58f3f83c29fe164713ee7765e21 (diff) |
[GFS] Fix bug in endian conversion for metadata header
In some cases 16 bit functions were being used rather than 32 bit
functions.
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
Diffstat (limited to 'fs/gfs2/util.h')
-rw-r--r-- | fs/gfs2/util.h | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/fs/gfs2/util.h b/fs/gfs2/util.h index addbe304993e..4532dbab0a2c 100644 --- a/fs/gfs2/util.h +++ b/fs/gfs2/util.h | |||
@@ -107,12 +107,11 @@ static inline int gfs2_metatype_check_i(struct gfs2_sbd *sdp, | |||
107 | { | 107 | { |
108 | struct gfs2_meta_header *mh = (struct gfs2_meta_header *)bh->b_data; | 108 | struct gfs2_meta_header *mh = (struct gfs2_meta_header *)bh->b_data; |
109 | uint32_t magic = mh->mh_magic; | 109 | uint32_t magic = mh->mh_magic; |
110 | uint16_t t = mh->mh_type; | 110 | uint16_t t = be32_to_cpu(mh->mh_type); |
111 | magic = be32_to_cpu(magic); | 111 | magic = be32_to_cpu(magic); |
112 | if (unlikely(magic != GFS2_MAGIC)) | 112 | if (unlikely(magic != GFS2_MAGIC)) |
113 | return gfs2_meta_check_ii(sdp, bh, "magic number", function, | 113 | return gfs2_meta_check_ii(sdp, bh, "magic number", function, |
114 | file, line); | 114 | file, line); |
115 | t = be16_to_cpu(t); | ||
116 | if (unlikely(t != type)) | 115 | if (unlikely(t != type)) |
117 | return gfs2_metatype_check_ii(sdp, bh, type, t, function, | 116 | return gfs2_metatype_check_ii(sdp, bh, type, t, function, |
118 | file, line); | 117 | file, line); |
@@ -127,8 +126,8 @@ static inline void gfs2_metatype_set(struct buffer_head *bh, uint16_t type, | |||
127 | { | 126 | { |
128 | struct gfs2_meta_header *mh; | 127 | struct gfs2_meta_header *mh; |
129 | mh = (struct gfs2_meta_header *)bh->b_data; | 128 | mh = (struct gfs2_meta_header *)bh->b_data; |
130 | mh->mh_type = cpu_to_be16(type); | 129 | mh->mh_type = cpu_to_be32(type); |
131 | mh->mh_format = cpu_to_be16(format); | 130 | mh->mh_format = cpu_to_be32(format); |
132 | } | 131 | } |
133 | 132 | ||
134 | 133 | ||