[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20130508230339.GC25399@ZenIV.linux.org.uk>
Date: Thu, 9 May 2013 00:03:39 +0100
From: Al Viro <viro@...IV.linux.org.uk>
To: "Darrick J. Wong" <darrick.wong@...cle.com>
Cc: Andreas Dilger <adilger@...ger.ca>, Theodore Ts'o <tytso@....edu>,
"linux-fsdevel@...r.kernel.org" <linux-fsdevel@...r.kernel.org>,
linux-ext4 <linux-ext4@...r.kernel.org>
Subject: Re: [PATCH] jbd2: Fix block tag checksum verification brokenness
On Wed, May 08, 2013 at 03:00:27PM -0700, Darrick J. Wong wrote:
> + crc = csum32 & 0xFFFF;
>
> - tag->t_checksum = cpu_to_be32(csum);
> + tag->t_checksum = cpu_to_be16(crc);
Simple cpu_to_be16(csum) will do - it'll convert the argument to __u16,
which will do exactly the same thing your & 0xFFFF is doing. Matter of
taste...
> + crc = csum32 & 0xFFFF;
> + provided = be16_to_cpu(tag->t_checksum);
>
> - return provided == cpu_to_be32(calculated);
> + return provided == crc;
I'd go for tag->t_checksum == cpu_to_be16(calculated) - less cluttered that
way, IMO. Again, a matter of taste. ACK, as far as correctness is concerned.
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists