[patch] Btrfs: remove some no-op casts

2016-10-12 Thread Dan Carpenter
We cast 0 to a u8 but then because of type promotion, it's immediately cast to int back to int before we do a bitwise negate. The cast doesn't matter in this case, the code works as intended. It causes a static checker warning though so let's remove it. Signed-off-by: Dan Carpent

smatch stuff: potential NULL dereference in btrfs_rm_device()

2011-11-08 Thread Dan Carpenter
= cur_devices->seed; dereferenced here. If we don't hit the break statement, then at the end of the loop we'd oops. regards, dan carpenter -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majord...@vger.kernel.org More majordomo

[patch] btrfs scrub: handle -ENOMEM from init_ipath()

2011-11-16 Thread Dan Carpenter
init_ipath() can return an ERR_PTR(-ENOMEM). Signed-off-by: Dan Carpenter diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c index ed11d38..b72ee47 100644 --- a/fs/btrfs/scrub.c +++ b/fs/btrfs/scrub.c @@ -256,6 +256,11 @@ static int scrub_print_warning_inode(u64 inum, u64 offset, u64 root, void

re: Btrfs: fix num_workers_starting bug and other bugs in async thread

2011-12-23 Thread Dan Carpenter
_btrfs_start_workers() enables them. Maybe that function should use spin_lock_irqsave() instead of spin_lock_irq(). regards, dan carpenter -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html

[patch] Btrfs: fix bitwise vs logical condition

2012-01-19 Thread Dan Carpenter
The intent here was to do a logical && instead of a bitwise &. The original condition tests whether they have the some of same bits set. I have fixed that and rewritten it to be more clear. Signed-off-by: Dan Carpenter --- Warning: This is a static analysis bug and I'm not v

[patch] Btrfs: use gfp_t to silence a sparse warning

2012-01-19 Thread Dan Carpenter
These should be gfp_t or Sparse complains: fs/btrfs/ulist.c:100:55: warning: incorrect type in argument 2 (different base types) Signed-off-by: Dan Carpenter diff --git a/fs/btrfs/ulist.c b/fs/btrfs/ulist.c index 12f5147..5d1b047 100644 --- a/fs/btrfs/ulist.c +++ b/fs/btrfs/ulist.c

Re: [patch] Btrfs: fix bitwise vs logical condition

2012-01-20 Thread Dan Carpenter
LOCK_GROUP_TYPE_MASK and BTRFS_BALANCE_TYPE_MASK which are the same except that the bitfields have been renamed. Can't we just reuse the first definition? But really, if this isn't a bug, then I don't care. The original is fine, or whatever you choose. regards, dan carpenter signature.asc Description: Digital signature

passing positive numbers to ERR_PTR()

2012-02-08 Thread Dan Carpenter
ot; can be either a negative error code, zero, or one here. 921 I looked at the code, but couldn't tell if it was intentional or not. It really is pretty unusual to do that, so maybe there should be a comment or something. regards, dan carpenter -- To unsubscribe from this list: send the li

[patch] Btrfs: silence a compiler warning

2012-02-21 Thread Dan Carpenter
Gcc warns that "ret" can be used uninitialized. It can't actually be used uninitialized because btrfs_num_copies() always returns 1 or more. Signed-off-by: Dan Carpenter diff --git a/fs/btrfs/check-integrity.c b/fs/btrfs/check-integrity.c index 064b29b..c053e90 100644 --- a

Re: [patch] Btrfs: silence a compiler warning

2012-02-22 Thread Dan Carpenter
On Wed, Feb 22, 2012 at 08:29:26AM -0800, David Brown wrote: > On Wed, Feb 22, 2012 at 10:30:55AM +0300, Dan Carpenter wrote: > >Gcc warns that "ret" can be used uninitialized. It can't actually be > >used uninitialized because btrfs_num_copies() always returns 1

[patch v2] Btrfs: silence a compiler warning

2012-02-22 Thread Dan Carpenter
Gcc warns that "ret" can be used uninitialized. It can't actually be used uninitialized because btrfs_num_copies() always returns 1 or more. Signed-off-by: Dan Carpenter --- v2: use the uninitialized_var() macro instead of initializing to 0. diff --git a/fs/btrfs/check-integri

re: btrfs: enhance transaction abort infrastructure

2012-04-02 Thread Dan Carpenter
tex_unlock(&root->fs_info->tree_log_mutex); 1413 goto cleanup_transaction; ^ Should we do an mutex_unlock(&root->fs_info->reloc_mutex); before these two gotos? 1414 } regards, dan carpenter -- To unsubscribe from this list: send the line "unsubscr

Re: btrfs: enhance transaction abort infrastructure

2012-04-02 Thread Dan Carpenter
On Mon, Apr 02, 2012 at 12:46:44PM +0200, David Sterba wrote: > > Thanks for cathing it. Are you going to send a patch or are you fine > with a Reported-by: ? > You're welcome. :) Reported-by is fine. regards, dan carpenter -- To unsubscribe from this list: send the line &

[patch 1/2] Btrfs: double unlock bug in error handling

2012-04-17 Thread Dan Carpenter
The caller expects this function to return with the lock held and releases it immediately on error. Signed-off-by: Dan Carpenter diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index 2b35f8d..a0bb9dc 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c @@ -2301,6

[patch 2/2] Btrfs: cleanup: use consistent lock naming

2012-04-17 Thread Dan Carpenter
It confuses Smatch that we use two names for the same lock. Plus the shorter name is nicer. This doesn't change how the code works, it's just a cleanup. Signed-off-by: Dan Carpenter diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index a0bb9dc..29c0445 100644 ---

Re: [patch 1/2] Btrfs: double unlock bug in error handling

2012-04-18 Thread Dan Carpenter
On Wed, Apr 18, 2012 at 01:29:46PM +0200, Jan Schmidt wrote: > On 18.04.2012 08:59, Dan Carpenter wrote: > I think the correct way to fix this is: > Yeah. I considered both ways, but I chose the one which makes the tools happy. Which is the wrong choice, because taking a pointles

re: btrfs: fix race in reada

2012-04-30 Thread Dan Carpenter
+logical >> PAGE_CACHE_SHIFT, 1); + if (ret == 1) + kref_get(&zone->refcnt); } + spin_unlock(&fs_info->reada_lock); return zone; } regards, dan carpenter -- To unsubscrib

Re: btrfs: fix race in reada

2012-04-30 Thread Dan Carpenter
On Mon, Apr 30, 2012 at 01:23:29PM +0200, Arne Jansen wrote: > On 30.04.2012 13:11, Dan Carpenter wrote: > > Hello Arne Jansen, > > > > The patch 8c9c2bf7a3c4: "btrfs: fix race in reada" from Feb 25, 2012, > > leads to the following warning: >

Re: btrfs: fix race in reada

2012-04-30 Thread Dan Carpenter
On Mon, Apr 30, 2012 at 01:23:29PM +0200, Arne Jansen wrote: > On 30.04.2012 13:11, Dan Carpenter wrote: > > Hello Arne Jansen, > > > > The patch 8c9c2bf7a3c4: "btrfs: fix race in reada" from Feb 25, 2012, > > leads to the following warning: >

Re: [PATCH 00/20] drop useless LIST_HEAD

2018-12-27 Thread Dan Carpenter
If we really have other clear rules, then it should be encoded into get_maintainer.pl so that it's automatic. My other question is why do the linux-arm-ker...@lists.infradead.org people feel like they need to be CC'd about every driver??? I always remove them from the CC list unless it'

[bug report] btrfs: change set_level() to bound the level passed in

2019-02-07 Thread Dan Carpenter
ialized if the first character is not ':'. 1579 1580level = btrfs_compress_op[type]->set_level(level); 1581 1582 return level; 1583 } regards, dan carpenter

[PATCH] btrfs: Silence a static checker locking warning

2019-02-09 Thread Dan Carpenter
it cleaner and to silence the static checkers. Signed-off-by: Dan Carpenter --- fs/btrfs/inode.c | 10 -- 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 9b0e3e2d589c..039a12f51cd7 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.

[PATCH] btrfs: drop the lock on error in btrfs_dev_replace_cancel()

2019-02-11 Thread Dan Carpenter
We should drop the lock on this error path. This is from static analysis and I don't know if it's possible to hit this error path in real life. Signed-off-by: Dan Carpenter --- fs/btrfs/dev-replace.c | 1 + 1 file changed, 1 insertion(+) diff --git a/fs/btrfs/dev-replace.c b/fs

Re: [PATCH] btrfs: Silence a static checker locking warning

2019-02-11 Thread Dan Carpenter
7;t thought about that read locks could nest. regards, dan carpenter

[PATCH] Btrfs: Fix an assert statement in __btrfs_map_block()

2019-08-09 Thread Dan Carpenter
The btrfs_get_chunk_map() never returns NULL, it returns error pointers. Fixes: 89b798ad1b42 ("btrfs: Use btrfs_get_io_geometry appropriately") Signed-off-by: Dan Carpenter --- fs/btrfs/volumes.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/btrfs/volumes.c

[bug report] btrfs: cleanup device states define BTRFS_DEV_STATE_IN_FS_METADATA

2017-12-08 Thread Dan Carpenter
) takes a bit number fs/btrfs/dev-replace.c:175 btrfs_init_dev_replace() warn: test_bit() takes a bit number fs/btrfs/dev-replace.c:310 btrfs_dev_name() warn: test_bit() takes a bit number fs/btrfs/dev-replace.c:570 btrfs_dev_replace_finishing() warn: test_bit() takes a bit number regards, dan carpenter

[bug report] btrfs: do an allocation earlier during snapshot creation

2020-12-17 Thread Dan Carpenter
^^^ If btrfs_commit_transaction() fails too early then this is freed but it's still in the ->pending_snapshots list leading to a use after free. 891 892 return ret; 893 } regards, dan carpenter

[kbuild] Re: [PATCH v3] btrfs: Make btrfs_direct_write atomic with respect to inode_lock

2021-01-04 Thread Dan Carpenter
.config) compiler: gcc-9 (Debian 9.3.0-15) 9.3.0 If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot Reported-by: Dan Carpenter New smatch warnings: fs/btrfs/file.c:1980 btrfs_direct_write() error: uninitialized symbol 'dsync'. Old smatch wa

[bug report] btrfs: introduce read_extent_buffer_subpage()

2021-01-28 Thread Dan Carpenter
btrfs_subpage_test_uptodate(fs_info, page, eb->start, eb->len)) { 5808 set_bit(EXTENT_BUFFER_UPTODATE, &eb->bflags); 5809 unlock_extent(io_tree, eb->start, eb->start + eb->len - 1); 5810 return ret; 5811 } regards, dan carpenter

Re: [PATCH] btrfs: add comment on why we can return 0 if we failed to atomically lock the page in read_extent_buffer_pages()

2021-01-28 Thread Dan Carpenter
Yeah. Once you know it's only for readahead then that makes perfect sense. Thanks! regards, dan carpenter

[bug report] btrfs: mark block groups to copy for device-replace

2021-02-03 Thread Dan Carpenter
ock(&fs_info->trans_lock); ^^^ 504 } 505 spin_unlock(&fs_info->trans_lock); Double unlock here. 506 507 path = btrfs_alloc_path(); 508 if (!path) { regards, dan carpenter

[PATCH] btrfs: prevent potential out of bounds in btrfs_ioctl_snap_create_v2()

2021-02-16 Thread Dan Carpenter
e we expected. Fixes: 6f72c7e20dba: ("Btrfs: add qgroup inheritance") Signed-off-by: Dan Carpenter --- Presumably only root can create snapshots. Anyway, I have not tested this fix. I believe it is correct, of course. But perhaps it's best to check. The calculation for t

[bug report] btrfs: add helper function check device delete able

2018-07-19 Thread Dan Carpenter
^^ 1884 1885 return device; 1886 } See also: regards, dan carpenter -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html

[bug report] btrfs: Add type check when reading a chunk

2018-07-19 Thread Dan Carpenter
osed to be | or perhaps check that both are set? 6389 btrfs_err(fs_info, 6390 "mixed chunk type in non-mixed mode: %llu", type); 6391 return -EIO; 6392 } 6393 } regards, dan c

[PATCH] btrfs: dereferencing error pointer in btrfs_quota_enable()

2018-08-02 Thread Dan Carpenter
The error handling in "goto out;" expects that if "trans" is non-NULL that means it's valid. Unfortunately it could also be an error pointer. Fixes: c9a6fe84fe43 ("btrfs: qgroups: Move transaction management inside btrfs_quota_enable/disable") Signed-off-

[PATCH] btrfs: use after free in btrfs_quota_enable()

2018-08-20 Thread Dan Carpenter
d it leads to a use after free inside the btrfs_end_transaction() macro. Fixes: 340f1aa27f36 ("btrfs: qgroups: Move transaction management inside btrfs_quota_enable/disable") Signed-off-by: Dan Carpenter diff --git a/fs/btrfs/qgroup.c b/fs/btrfs/qgroup.c index 4353bb69bb86..d4917c0cddf5

Re: [PATCH v2] fs/btrfs: Fix uninitialized variable

2021-04-20 Thread Dan Carpenter
hift); break; It took me a while to spot these break statements. > + default: > + zone = 0; > + break; This break needs to be indented one more tab. > } > > ASSERT(zone <= U32_MAX); regards, dan carpenter

Re: [PATCH -next] btrfs: Fix type conversion in btrfs_read_root_item

2019-02-19 Thread Dan Carpenter
cast to unsigned and the extra cast is silly. > +min_t(u32, len, sizeof(*item))); regards, dan carpenter

Re: [PATCH -next] btrfs: Fix type conversion in btrfs_read_root_item

2019-02-19 Thread Dan Carpenter
On Wed, Feb 20, 2019 at 08:58:43AM +0300, Dan Carpenter wrote: > On Wed, Feb 20, 2019 at 03:08:40AM +, YueHaibing wrote: > > btrfs_item_size_nr return value is u32, convert it to int may result > > in truncation.Also read_extent_buffer expect a unsigned param, so > > min_

Re: [PATCH v2 -next] btrfs: Remove unnecessary casts in btrfs_read_root_item

2019-02-20 Thread Dan Carpenter
; wouldn't want to pass negatives to read_extent_buffer(). Also there > is an extra cast. > > This patch shouldn't affect runtime, it's just a clean up. > > Suggested-by: Dan Carpenter It wasn't really suggested by me... But I do think it's the right thing. Reviewed-by: Dan Carpenter regards, dan carpenter

[bug report] btrfs: locking: Add extra check in btrfs_init_new_buffer() to avoid deadlock

2019-02-21 Thread Dan Carpenter
lock %llu owner %llu already locked by pid=%d, extent tree corruption detected", 8559buf->start, btrfs_header_owner(buf), current->pid); 8560 free_extent_buffer(buf); regards, dan carpenter

Re: [PATCH] btrfs: Fix possible NULL pointer dereference in btrfs selftest

2019-02-21 Thread Dan Carpenter
() and run_test(). regards, dan carpenter

[bug report] btrfs: get fs_info from block group in write_pinned_extent_entries

2019-04-24 Thread Dan Carpenter
return 0; 1054 See also: fs/btrfs/free-space-cache.c:1319 __btrfs_write_out_cache() warn: variable dereferenced before check 'block_group' (see line 1295) fs/btrfs/free-space-cache.c:1295 __btrfs_write_out_cache() error: we previously assumed 'block_group' could be null (see line 1253) regards, dan carpenter

[bug report] btrfs: Add unprivileged version of ino_lookup ioctl

2018-05-30 Thread Dan Carpenter
goto out; 2483 } 2484 regards, dan carpenter -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html

[PATCH] Btrfs: checking for NULL instead of IS_ERR

2018-05-30 Thread Dan Carpenter
memdup_user() returns error pointers, it doesn't return NULL. Fixes: 01141b08dee5 ("btrfs: Add unprivileged ioctl which returns subvolume's ROOT_REF") Signed-off-by: Dan Carpenter diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index ff5018587bd9..d8dd4504bdab 100644 --

[patch] block: precedence bug in bio_set_op_attrs() macro

2016-11-10 Thread Dan Carpenter
This code causes a problem for flush_epd_write_bio() because | has higher precedence than ?: so it basically turns into: ((bio)->bi_opf |= REQ_SYNC; Which is wrong. Fixes: ef295ecf090d ("block: better op and flags encoding") Signed-off-by: Dan Carpenter diff --git a/

[bug report] btrfs: Expoert and move leaf/subtree qgroup helpers to qgroup.c

2016-11-10 Thread Dan Carpenter
0; 1684 path->locks[root_level] = 0; /* so release_path doesn't try to unlock */ 1685 walk_down: regards, dan carpenter -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html

[bug report] btrfs: root->fs_info cleanup, add fs_info convenience variables

2016-12-22 Thread Dan Carpenter
e_ptr; 233 struct btrfs_key key; 234 int name_len; 235 int ret; 236 u64 ino; 237 238 if (!dir || !inode) ^ Old code checked for NULL. 239 return -EINVAL; 240 regards, dan carpente

[patch] btrfs: white space cleanup in btrfs_log_inode()

2017-01-25 Thread Dan Carpenter
We accidentally deleted a new line in commit 0921910aa6fe ("btrfs: Make btrfs_log_inode take btrfs_inode") Signed-off-by: Dan Carpenter diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c index f1dc36a181db..010cf7685677 100644 --- a/fs/btrfs/tree-log.c +++ b/fs/btrfs/tree-log.c

[patch] btrfs: scrub: silence an uninitialized variable warning

2016-03-11 Thread Dan Carpenter
It's basically harmless if "ref_level" isn't initialized since it's only used for an error message, but it causes a static checker warning. Signed-off-by: Dan Carpenter diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c index e42aa27..39dbdcb 100644 --- a/fs/btrfs/scrub

re: Btrfs: remove empty block groups automatically

2016-03-18 Thread Dan Carpenter
goto out; 1476 leaf = path->nodes[0]; 1477 btrfs_item_key_to_cpu(leaf, &found_key, path->slots[0]); 1478 extent = btrfs_item_ptr(leaf, path->slots[0], regards, dan carpenter -- To unsubscribe from this list: send the line

re: Btrfs: get/set for struct header fields

2016-03-19 Thread Dan Carpenter
if (btrfs_header_level(next) != 363 level - 1) 364 BUG(); 365 btrfs_print_tree(root, next); 366 free_extent_buffer(next); 367 } regards, dan carpenter -- To unsubscribe from this list: send th

re: Btrfs: fix up read_tree_block to return proper error

2016-03-19 Thread Dan Carpenter
btrfs_tree_lock(eb); ^^ Dereference. 1859 if (cow) { 1860 ret = btrfs_cow_block(trans, dest, eb, parent, 1861slot, &eb); regards, dan car

Re: [PATCH] delete obsolete function btrfs_print_tree()

2016-04-04 Thread Dan Carpenter
extra bytes of memory! Such a waste!" But we could use instead use___GFP_NOFAIL instead. Or BUG_ON(!foo)". I have gotten distracted. What was the question again? regards, dan carpenter -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a

[patch] btrfs: send: silence an integer overflow warning

2016-04-12 Thread Dan Carpenter
The "sizeof(*arg->clone_sources) * arg->clone_sources_count" expression can overflow. It causes several static checker warnings. It's all under CAP_SYS_ADMIN so it's not that serious but lets silence the warnings. Signed-off-by: Dan Carpenter diff --git a/fs/btrf

[PATCH] Btrfs: fix an integer overflow check

2017-03-17 Thread Dan Carpenter
1); sctx->clone_roots = kzalloc(alloc_size, GFP_KERNEL | __GFP_NOWARN); Fixes: f5ecec3ce21f ("btrfs: send: silence an integer overflow warning") Signed-off-by: Dan Carpenter diff --git a/fs/btrfs/send.c b/fs/btrfs/send.c index 030d592ed1fe..ad9508e67384 100644 --- a/fs/btrfs

[PATCH] Btrfs: remove some dead code

2017-04-11 Thread Dan Carpenter
btrfs_get_extent() never returns NULL pointers, so this code introduces a static checker warning. The btrfs_get_extent() is a bit complex, but trust me that it doesn't return NULLs and also if it did we would trigger the BUG_ON(!em) before the last return statement. Signed-off-by: Dan Carp

[PATCH] Btrfs: remove an unused variable

2017-05-02 Thread Dan Carpenter
"item" is never used. Signed-off-by: Dan Carpenter diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 1e4e4532f381..337aef86dae5 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -5881,7 +5881,6 @@ static int btrfs_real_readdir(struct file *file, struct dir_co

re: Btrfs: cleanup destroy_marked_extents

2013-05-09 Thread Dan Carpenter
if (!eb) ^^^ New check. Maybe we should be adding "root->leafsize" here? Just the check earlier would cause a forever loop. 3815 continue; 3816 wait_on_extent_buffer_write

[patch] btrfs/raid56: fix and cleanup some error paths

2013-07-21 Thread Dan Carpenter
though, so I have added some more calls to kfree(). Signed-off-by: Dan Carpenter diff --git a/fs/btrfs/raid56.c b/fs/btrfs/raid56.c index 0525e13..0db856c 100644 --- a/fs/btrfs/raid56.c +++ b/fs/btrfs/raid56.c @@ -1687,11 +1687,8 @@ int raid56_parity_write(struct btrfs_root *root, struct

Re: [patch] btrfs/raid56: fix and cleanup some error paths

2013-07-22 Thread Dan Carpenter
On Mon, Jul 22, 2013 at 04:47:00PM +0800, Miao Xie wrote: > On mon, 22 Jul 2013 09:55:15 +0300, Dan Carpenter wrote: > > The alloc_rbio() frees "raid_map" and "bbio" on error, so there is a > > potential double free bug in raid56_parity_write().

re: btrfs: reada: simplify dev->reada_in_flight processing

2016-02-17 Thread Dan Carpenter
return 0; 701 } 702 re->scheduled = 1; 703 spin_unlock(&re->lock); 704 regards, dan carpenter -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message

[patch] btrfs: array overflow in btrfs_ioctl_rm_dev_v2()

2016-02-17 Thread Dan Carpenter
We were putting the NUL terminator at BTRFS_PATH_NAME_MAX (4087) bytes instead of BTRFS_SUBVOL_NAME_MAX (4039) so it corrupted memory. Fixes: 22af1a869288 ('btrfs: introduce device delete by devid') Signed-off-by: Dan Carpenter diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c ind

re: Btrfs: don't start the log transaction if the log tree init fails

2015-08-14 Thread Dan Carpenter
ew Smatch thing I am working on and I am investigating false positives. 179 ret = btrfs_add_log_tree(trans, root); 180 if (ret) 181 goto out; 182 } regards, dan carpenter -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html

re: btrfs: check unsupported filters in balance arguments

2015-10-21 Thread Dan Carpenter
s: 4665 kfree(bargs); 4666 out_unlock: 4667 mutex_unlock(&fs_info->balance_mutex); 4668 mutex_unlock(&fs_info->volume_mutex); 4669 if (need_unlock) 4670 atomic_set(&fs_info->mutually_exclusive_operation_running, 0); 4671

re: btrfs: add tracing for failed reservations

2015-11-10 Thread Dan Carpenter
btrfs_end_transaction(trans, root); 4111 } 4112 } 4113 4114 trace_btrfs_space_reservation(root->fs_info, 4115"space_info:enospc", 4116 data_sinfo->flags, bytes, 1);

[patch] Btrfs: tests: checking for NULL instead of IS_ERR()

2015-11-10 Thread Dan Carpenter
btrfs_alloc_dummy_root() return an error pointer on failure, it never returns NULL. Signed-off-by: Dan Carpenter diff --git a/fs/btrfs/tests/free-space-tests.c b/fs/btrfs/tests/free-space-tests.c index c8c3d70..8b72b00 100644 --- a/fs/btrfs/tests/free-space-tests.c +++ b/fs/btrfs/tests/free

re: btrfs: extend balance filter usage to take minimum and maximum

2015-11-12 Thread Dan Carpenter
p;& 3075 !(bctl->meta.flags & BTRFS_BALANCE_ARGS_CONVERT)) { Same. 3076 bctl->meta.flags |= BTRFS_BALANCE_ARGS_USAGE; 3077 bctl->meta.usage = 90; 3078 } 3079 } regards, dan carpenter -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html

[PATCH] btrfs: use new block error code

2017-06-19 Thread Dan Carpenter
This function is supposed to return blk_status_t error codes now but there was a stray -ENOMEM left behind. Fixes: 4e4cbee93d56 ("block: switch bios to blk_status_t") Signed-off-by: Dan Carpenter diff --git a/fs/btrfs/compression.c b/fs/btrfs/compression.c index e536e98fe351..2c

[bug report] Btrfs: replace tree->mapping with tree->private_data

2017-06-28 Thread Dan Carpenter
continue; 3422 } 3423 3424 set_range_writeback(tree, cur, cur + iosize - 1); The patch adds a new unchecked dereference. regards, dan carpenter -- To unsubscribe from this list:

[bug report] btrfs: get fs_info from eb in btrfs_print_leaf, remove argument

2017-07-19 Thread Dan Carpenter
return; 183 regards, dan carpenter -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html

Re: [PATCH 2/5] btrfs: Use common error handling code in __btrfs_free_extent()

2017-08-21 Thread Dan Carpenter
> at the end of this function. > > > > This issue was detected by using the Coccinelle software. > > btrfs_abort_transaction dumps __FILE__:__LINE__ in the log so this patch > makes the code more difficult to debug. > I was just reviewing this and I missed that issue. The

Re: [PATCH 4/5] btrfs: Use common error handling code in update_ref_path()

2017-08-21 Thread Dan Carpenter
like bashing my face into the keyboard for all the good it does. On the other hand, some people accept these oddly placed labels... No one else writes code like this so far as I know. regards, dan carpenter -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs"

[bug report] btrfs: error out if btrfs_attach_transaction() fails

2017-10-12 Thread Dan Carpenter
2505 error: 2506 blkdev_put(bdev, FMODE_EXCL); 2507 if (seeding_dev && !unlocked) { 2508 mutex_unlock(&uuid_mutex); 2509 up_write(&sb->s_umount); 2510 } 2511 return ret; 2512 } regards, dan carpenter

[PATCH] Btrfs: ref-verify: Fix NULL vs IS_ERR() check in walk_down_tree()

2017-10-18 Thread Dan Carpenter
read_tree_block() returns error pointers, and never NULL and so I have updated the error handling. Fixes: 74739121b4c7 ("Btrfs: add a extent ref verify tool") Signed-off-by: Dan Carpenter diff --git a/fs/btrfs/ref-verify.c b/fs/btrfs/ref-verify.c index f65d78cf3c7e..34878699d363 10064

[patch] btrfs: delayed-ref: double free in btrfs_add_delayed_tree_ref()

2015-06-24 Thread Dan Carpenter
There is a cut and paste error so instead of freeing "head_ref", we free "ref" twice. Fixes: 3368d001ba5d ('btrfs: qgroup: Record possible quota-related extent for qgroup.') Signed-off-by: Dan Carpenter diff --git a/fs/btrfs/delayed-ref.c b/fs/btrfs/delayed-ref.c

re: btrfs: initial readahead code and prototypes

2012-05-17 Thread Dan Carpenter
s(eb) : 0; ^ Checked here again indirectly. 147 generation = btrfs_header_generation(eb); ^^^ Dereferenced inside function without checking. 148 /* 149

Re: btrfs: initial readahead code and prototypes

2012-05-17 Thread Dan Carpenter
I missed the comment. > This code changes significantly with the patch > > btrfs: extend readahead interface > > Where it is written in a more obvious way. Cool. regards, dan carpenter -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body o

re: Btrfs: add support for multiple csum algorithms

2012-06-15 Thread Dan Carpenter
t;start, val, found, 306 btrfs_header_level(buf)); 307 if (result != (char *)&inline_result) 308 kfree(result); 309 return 1; regards, dan carpenter -- To

re: Btrfs: fix locking in btrfs_destroy_delayed_refs

2012-06-18 Thread Dan Carpenter
Or if we exit, then this is a double unlock. There is some complicated locking going on in that function so I don't pretend to understand it. Sorry, if I've misread something. regards, dan carpenter -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html

[patch] Btrfs: small naming cleanup in join_transaction()

2012-06-19 Thread Dan Carpenter
"root->fs_info" and "fs_info" are the same, but "fs_info" is prefered because it is shorter and that's what is used in the rest of the function. Signed-off-by: Dan Carpenter --- Also, Smatch doesn't understand that they are the same so it complain

[report] NULL dereference in __update_reloc_root()

2012-06-21 Thread Dan Carpenter
list_del_init(&root->root_list); 1283 spin_unlock(&root->fs_info->trans_lock); 1284 kfree(node); ^^^ And here as well I guess. 1285 } 1286 return 0; regards, dan carpenter -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html

[patch] Btrfs: dereferencing free'd memory in panic message

2012-06-22 Thread Dan Carpenter
We free "node" and then dereference it in the panic message on the next line. I considered moving the kfree() after the panic given that panic can return under certain configurations, but in the end I decided it doesn't matter if we leak a bit after a panic. Signed-off-by: Dan C

Re: [patch] Btrfs: dereferencing free'd memory in panic message

2012-06-22 Thread Dan Carpenter
On Fri, Jun 22, 2012 at 09:09:04AM -0400, Josef Bacik wrote: > On 06/22/2012 03:14 AM, Dan Carpenter wrote: > >We free "node" and then dereference it in the panic message on the next > >line. I considered moving the kfree() after the panic given that panic &g

[patch v2] Btrfs: fix error handling in __add_reloc_root()

2012-06-25 Thread Dan Carpenter
We dereferenced "node" in the error message after freeing it. Also btrfs_panic() can return so we should return an error code instead of continuing. Signed-off-by: Dan Carpenter --- v2: in the first version I just deleted the kfree(). diff --git a/fs/btrfs/relocation.c b/fs/btrfs/re

Re: [patch v2] Btrfs: fix error handling in __add_reloc_root()

2012-06-25 Thread Dan Carpenter
On Mon, Jun 25, 2012 at 09:41:12AM -0400, Josef Bacik wrote: > On Mon, Jun 25, 2012 at 05:15:23AM -0600, Dan Carpenter wrote: > > We dereferenced "node" in the error message after freeing it. Also > > btrfs_panic() can return so we should return an error code

Re: [patch v2] Btrfs: fix error handling in __add_reloc_root()

2012-06-25 Thread Dan Carpenter
not on my end. It made it to marc.info without getting corrupted. Marc.info strips out the From: and Subject: headers so you'd have to add them in manually. 1) Save this file: http://marc.info/?l=kernel-janitors&m=134062314509635&q=raw 2) Edit the file and add these two lines ad

[patch] Btrfs: fix some endian bugs handling the root times

2012-07-30 Thread Dan Carpenter
"trans->transid" is cpu endian but we want to store the data as little endian. "item->ctime.nsec" is only 32 bits, not 64. Signed-off-by: Dan Carpenter --- Applies to linux-next. diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index 43f0012..a1fbca0 100644 --- a

[patch] Btrfs: unlock on error in btrfs_delalloc_reserve_metadata()

2012-07-30 Thread Dan Carpenter
We should release this mutex before returning the error code. Signed-off-by: Dan Carpenter --- Applies to linux-next. diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index 4e1b153..45c69c4 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c @@ -4571,8 +4571,10 @@ int

[patch 1/2] Btrfs: checking for NULL instead of IS_ERR

2012-07-30 Thread Dan Carpenter
add_qgroup_rb() never returns NULL, only error pointers. Signed-off-by: Dan Carpenter --- Applies to linux-next. diff --git a/fs/btrfs/qgroup.c b/fs/btrfs/qgroup.c index bc424ae..b650155 100644 --- a/fs/btrfs/qgroup.c +++ b/fs/btrfs/qgroup.c @@ -1364,8 +1364,10 @@ int btrfs_qgroup_inherit

[patch 2/2] Btrfs: fix some error codes in btrfs_qgroup_inherit()

2012-07-30 Thread Dan Carpenter
These are returning zero when it should be returning a negative error code. Signed-off-by: Dan Carpenter --- Applies to linux-next. diff --git a/fs/btrfs/qgroup.c b/fs/btrfs/qgroup.c index b650155..38b42e7 100644 --- a/fs/btrfs/qgroup.c +++ b/fs/btrfs/qgroup.c @@ -1371,8 +1371,10 @@ int

Re: Cannot create subvolume with quota enabled

2012-09-11 Thread Dan Carpenter
On Tue, Sep 11, 2012 at 04:35:26AM -0400, Marios Titas wrote: > On Tue, Sep 11, 2012 at 2:19 AM, Arne Jansen wrote: > > > > instead of applying my patch, could you please just revert > > > > commit 5986802c2fcc754040bb7ed95f30bb16c4a843b7 > > Author: Dan Carpenter

re: btrfs: fix check_shared for fiemap ioctl

2016-06-07 Thread Dan Carpenter
if (node->ref_mod > 0) ^ Use after free. 278 ref_tree->unique_refs += origin_count > 0 ? 0 : 1; 279 else if (node->ref_mod <= 0) 280 ref_tree->unique_refs += origin_count > 0 ? -1 : 0; 281 282 ret

[bug report] btrfs: root->fs_info cleanup, add fs_info convenience variables

2016-07-08 Thread Dan Carpenter
struct btrfs_key key; 234 int name_len; 235 int ret; 236 u64 ino; 237 238 if (!dir || !inode) ^ Old code assumed it can be NULL. 239 return -EINVAL; 240 regards, dan carpenter --

re: btrfs: add tracing for failed reservations

2013-11-13 Thread Dan Carpenter
trace_btrfs_space_reservation(root->fs_info, 3709"space_info:enospc", 3710data_sinfo->flags, bytes, 1); ^ Patch introdu

Re: Btrfs: add support for multiple csum algorithms

2012-12-11 Thread Dan Carpenter
This is a memory corruption bug, could someone take a look at it? regards, dan carpetner On Fri, Jun 15, 2012 at 10:49:22PM +0300, Dan Carpenter wrote: > Hello Josef Bacik, > > The patch 607d432da054: "Btrfs: add support for multiple csum > algorithms" from Dec 2, 2008,

[josef-btrfs:master 105/117] fs/btrfs/tree-log.c:3401 log_one_extent() error: double unlock 'irq:'

2012-12-14 Thread Dan Carpenter
Hi Josef, FYI, there are new smatch warnings show up in tree: git://git.kernel.org/pub/scm/linux/kernel/git/josef/btrfs-next.git master head: 39a6066ac26f336b444c666a4b7339078ebf19b1 commit: 2d6d440d12fe503bc909f9f9e1fe8771d84f [105/117] Btrfs: wait on ordered extents at the last possib

[josef-btrfs:master 21/21] fs/btrfs/ioctl.c:1436 btrfs_ioctl_resize() error: 'device' dereferencing possible ERR_PTR()

2012-12-20 Thread Dan Carpenter
[ get_avail_device() sometimes returns an ERR_PTR ] Hi Liu, FYI, there are new smatch warnings show up in tree: git://git.kernel.org/pub/scm/linux/kernel/git/josef/btrfs-next.git master head: 3d294381647ab114f525a0ccf3d28f8172ce6a5f commit: 3d294381647ab114f525a0ccf3d28f8172ce6a5f [21/21] B

[patch] Btrfs: fix access_ok() check in btrfs_ioctl_send()

2013-01-10 Thread Dan Carpenter
The closing parenthesis is in the wrong place. We want to check "sizeof(*arg->clone_sources) * arg->clone_sources_count" instead of "sizeof(*arg->clone_sources * arg->clone_sources_count)". Signed-off-by: Dan Carpenter --- This is also vulnerable to integer overf

re: Btrfs: add optional integrity check code

2014-05-09 Thread Dan Carpenter
;sf->error" here? I don't know the code well enough to say the answer. 1099 goto one_stack_frame_backwards; 1100 } 1101 1102 next_stack->i =

  1   2   >