Re: [PATCH] btrfs: fix a overflowing boundary writing in csum_tree_block

2014-09-29 Thread David Sterba
On Thu, Sep 11, 2014 at 10:02:16AM -0400, Chris Mason wrote: > On 09/09/2014 05:19 AM, rongqing...@windriver.com wrote: > > From: Li RongQing > > > > It is impossible that csum_size is larger than sizeof(long), but the codes > > still add the handler for this condition, like allocate new memory,

Re: [PATCH] btrfs: fix a overflowing boundary writing in csum_tree_block

2014-09-11 Thread Li RongQing
Do you means we can handle it like below? I think it is not better, if that, csum size can not the expand, and the code in csum_tree_block seems redundancy; If you do not want to truncate in first patch, I think we can try to avoid it diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c index 22a367

Re: [PATCH] btrfs: fix a overflowing boundary writing in csum_tree_block

2014-09-11 Thread Chris Mason
On 09/09/2014 05:19 AM, rongqing...@windriver.com wrote: > From: Li RongQing > > It is impossible that csum_size is larger than sizeof(long), but the codes > still add the handler for this condition, like allocate new memory, for > extension. If it becomes true someday, copying csum_size size mem

[PATCH] btrfs: fix a overflowing boundary writing in csum_tree_block

2014-09-09 Thread rongqing.li
From: Li RongQing It is impossible that csum_size is larger than sizeof(long), but the codes still add the handler for this condition, like allocate new memory, for extension. If it becomes true someday, copying csum_size size memory to local 32bit variable found and val will overflow these two v