[Btrfs-devel][PATCH]Minor fix for btrfs_csum_file_block.

Chris Mason chris.mason at ORACLE.COM
Mon Oct 29 09:00:19 PDT 2007


On Mon, 29 Oct 2007 08:22:19 +0800
"Yan Zheng" <yanzheng at 21cn.com> wrote:

> Hello,
> 
> Execution should goto label 'insert' when 'btrfs_next_leaf' return a
> non-zero value, otherwise the parameter 'slot' for
> 'btrfs_item_key_to_cpu' may be out of bounds. The original codes jump
> to  label 'insert' only when 'btrfs_next_leaf' return a negative
> value.

I made one small change here:


> @@ -238,7 +236,7 @@ insert:
>  	csum_offset = 0;
>  	if (found_next) {
>  		u64 tmp = min((u64)i_size_read(inode), next_offset);
> -		tmp -= offset + root->sectorsize - 1;
> +		tmp -= offset - root->sectorsize + 1;

		tmp -= offset & ~((u64)root->sectorsize - 1);

But I've pushed out all three patches.

-chris



More information about the Btrfs-devel mailing list