linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Al Viro <viro@ZenIV.linux.org.uk>
To: "Darrick J. Wong" <darrick.wong@oracle.com>
Cc: Andreas Dilger <adilger@dilger.ca>, Theodore Ts'o <tytso@mit.edu>,
	"linux-fsdevel@vger.kernel.org" <linux-fsdevel@vger.kernel.org>,
	linux-ext4 <linux-ext4@vger.kernel.org>
Subject: Re: [PATCH] jbd2: Fix block tag checksum verification brokenness
Date: Thu, 9 May 2013 00:03:39 +0100	[thread overview]
Message-ID: <20130508230339.GC25399@ZenIV.linux.org.uk> (raw)
In-Reply-To: <20130508220027.GB7730@blackbox.djwong.org>

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.

      reply	other threads:[~2013-05-08 23:03 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-08 22:00 [PATCH] jbd2: Fix block tag checksum verification brokenness Darrick J. Wong
2013-05-08 23:03 ` Al Viro [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130508230339.GC25399@ZenIV.linux.org.uk \
    --to=viro@zeniv.linux.org.uk \
    --cc=adilger@dilger.ca \
    --cc=darrick.wong@oracle.com \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=tytso@mit.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).