[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Pine.LNX.4.61.0612020939460.1635@yvahk01.tjqt.qr>
Date: Sat, 2 Dec 2006 09:40:16 +0100 (MET)
From: Jan Engelhardt <jengelh@...ux01.gwdg.de>
To: Steven Whitehouse <swhiteho@...hat.com>
cc: cluster-devel@...hat.com, linux-kernel@...r.kernel.org
Subject: Re: [GFS2] Fix crc32 calculation in recovery.c [8/70]
>Commit "[GFS2] split and annotate gfs2_log_head" resulted in an incorrect
>checksum calculation for log headers. This patch corrects the
>problem without resorting to copying the whole log header as
>the previous code used to.
>
>Cc: Al Viro <viro@...iv.linux.org.uk>
>Signed-off-by: Steven Whitehouse <swhiteho@...hat.com>
>---
> fs/gfs2/recovery.c | 9 +++++----
> 1 files changed, 5 insertions(+), 4 deletions(-)
>
>diff --git a/fs/gfs2/recovery.c b/fs/gfs2/recovery.c
>index 4478162..4acf238 100644
>--- a/fs/gfs2/recovery.c
>+++ b/fs/gfs2/recovery.c
>@@ -136,6 +136,7 @@ static int get_log_header(struct gfs2_jd
> {
> struct buffer_head *bh;
> struct gfs2_log_header_host lh;
>+static const u32 nothing = 0;
> u32 hash;
> int error;
>
At least indent it.
>@@ -143,11 +144,11 @@ static int get_log_header(struct gfs2_jd
> if (error)
> return error;
>
>- memcpy(&lh, bh->b_data, sizeof(struct gfs2_log_header)); /* XXX */
>- lh.lh_hash = 0;
>- hash = gfs2_disk_hash((char *)&lh, sizeof(struct gfs2_log_header));
>+ hash = crc32_le((u32)~0, bh->b_data, sizeof(struct gfs2_log_header) -
>+ sizeof(u32));
>+ hash = crc32_le(hash, (unsigned char const *)¬hing, sizeof(nothing));
>+ hash ^= (u32)~0;
> gfs2_log_header_in(&lh, bh->b_data);
>-
> brelse(bh);
>
> if (lh.lh_header.mh_magic != GFS2_MAGIC ||
>--
>1.4.1
-`J'
--
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists