diff options
author | Darrick J. Wong <darrick.wong@oracle.com> | 2013-08-28 14:59:58 -0400 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2013-08-28 14:59:58 -0400 |
commit | 18a6ea1e5cc88ba36e66c193196da802b06d5cb0 (patch) | |
tree | 783980ea5139de37bbb2c01124a42c2c53a9f83b /fs/jbd2/commit.c | |
parent | d7b2a00c2e2eedf460ce2a15237f28de40412d86 (diff) |
jbd2: Fix endian mixing problems in the checksumming code
In the jbd2 checksumming code, explicitly declare separate variables with
endianness information so that we don't get confused and screw things up again.
Also fixes sparse warnings.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'fs/jbd2/commit.c')
-rw-r--r-- | fs/jbd2/commit.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/fs/jbd2/commit.c b/fs/jbd2/commit.c index 559bec1a37b4..cf2fc0594063 100644 --- a/fs/jbd2/commit.c +++ b/fs/jbd2/commit.c | |||
@@ -343,14 +343,14 @@ static void jbd2_block_tag_csum_set(journal_t *j, journal_block_tag_t *tag, | |||
343 | struct page *page = bh->b_page; | 343 | struct page *page = bh->b_page; |
344 | __u8 *addr; | 344 | __u8 *addr; |
345 | __u32 csum32; | 345 | __u32 csum32; |
346 | __be32 seq; | ||
346 | 347 | ||
347 | if (!JBD2_HAS_INCOMPAT_FEATURE(j, JBD2_FEATURE_INCOMPAT_CSUM_V2)) | 348 | if (!JBD2_HAS_INCOMPAT_FEATURE(j, JBD2_FEATURE_INCOMPAT_CSUM_V2)) |
348 | return; | 349 | return; |
349 | 350 | ||
350 | sequence = cpu_to_be32(sequence); | 351 | seq = cpu_to_be32(sequence); |
351 | addr = kmap_atomic(page); | 352 | addr = kmap_atomic(page); |
352 | csum32 = jbd2_chksum(j, j->j_csum_seed, (__u8 *)&sequence, | 353 | csum32 = jbd2_chksum(j, j->j_csum_seed, (__u8 *)&seq, sizeof(seq)); |
353 | sizeof(sequence)); | ||
354 | csum32 = jbd2_chksum(j, csum32, addr + offset_in_page(bh->b_data), | 354 | csum32 = jbd2_chksum(j, csum32, addr + offset_in_page(bh->b_data), |
355 | bh->b_size); | 355 | bh->b_size); |
356 | kunmap_atomic(addr); | 356 | kunmap_atomic(addr); |