lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Wed, 3 Apr 2013 11:37:42 -0400
From:	Theodore Ts'o <tytso@....edu>
To:	Dmitry Monakhov <dmonakhov@...nvz.org>
Cc:	linux-ext4@...r.kernel.org, wenqing.lz@...bao.com
Subject: Re: [PATCH 2/2] ext4: fix cpu_vs_disk conversions

On Wed, Apr 03, 2013 at 02:58:31PM +0400, Dmitry Monakhov wrote:
> diff --git a/fs/ext4/xattr.c b/fs/ext4/xattr.c
> index 3a120b2..34da740 100644
> --- a/fs/ext4/xattr.c
> +++ b/fs/ext4/xattr.c
> @@ -123,16 +123,15 @@ static __le32 ext4_xattr_block_csum(struct inode *inode,
>  {
>  	struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb);
>  	__u32 csum, old;
> -
> -	old = hdr->h_checksum;
> +	__le64 dsk_block_nr = cpu_to_le64(block_nr);
> +	old = le32_to_cpu(hdr->h_checksum);

We're just saving and restoring hdr->h_checksum.  So instead of
byte-swapping the checksum in old, and then swapping it back, why not
just do this instead:

     __le32 old;

     old = hdr->h_checksum;
     ...
     hdr->h_checksum = old;

					- Ted
--
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