Re: [PATCH] jbd2: Fix block tag checksum verification brokenness

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Reiser Filesystem Development]     [Ceph FS]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite National Park]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]     [Linux Media]

  Powered by Linux