* [PATCH -next] btrfs: sysfs: fix return value check in btrfs_force_chunk_alloc_s()
@ 2022-06-08 2:12 Wei Yongjun
2022-06-08 21:17 ` David Sterba
0 siblings, 1 reply; 2+ messages in thread
From: Wei Yongjun @ 2022-06-08 2:12 UTC (permalink / raw)
To: weiyongjun1, Stefan Roesch, Chris Mason, Josef Bacik,
David Sterba, Nick Terrell
Cc: linux-btrfs, kernel-janitors, Hulk Robot
In case of error, the function btrfs_start_transaction() returns
ERR_PTR() and never returns NULL. The NULL test in the return value
check should be replaced with IS_ERR().
Fixes: 46e1bce0ac34 ("btrfs: sysfs: add force_chunk_alloc trigger to force allocation")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
---
fs/btrfs/sysfs.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/btrfs/sysfs.c b/fs/btrfs/sysfs.c
index ebe76d7a4a64..4186fdcbcdee 100644
--- a/fs/btrfs/sysfs.c
+++ b/fs/btrfs/sysfs.c
@@ -807,7 +807,7 @@ static ssize_t btrfs_force_chunk_alloc_store(struct kobject *kobj,
* unexpected problems.
*/
trans = btrfs_start_transaction(fs_info->tree_root, 0);
- if (!trans)
+ if (IS_ERR(trans))
return PTR_ERR(trans);
ret = btrfs_force_chunk_alloc(trans, space_info->flags);
btrfs_end_transaction(trans);
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH -next] btrfs: sysfs: fix return value check in btrfs_force_chunk_alloc_s()
2022-06-08 2:12 [PATCH -next] btrfs: sysfs: fix return value check in btrfs_force_chunk_alloc_s() Wei Yongjun
@ 2022-06-08 21:17 ` David Sterba
0 siblings, 0 replies; 2+ messages in thread
From: David Sterba @ 2022-06-08 21:17 UTC (permalink / raw)
To: Wei Yongjun
Cc: Stefan Roesch, Chris Mason, Josef Bacik, David Sterba,
Nick Terrell, linux-btrfs, kernel-janitors, Hulk Robot
On Wed, Jun 08, 2022 at 02:12:52AM +0000, Wei Yongjun wrote:
> In case of error, the function btrfs_start_transaction() returns
> ERR_PTR() and never returns NULL. The NULL test in the return value
> check should be replaced with IS_ERR().
>
> Fixes: 46e1bce0ac34 ("btrfs: sysfs: add force_chunk_alloc trigger to force allocation")
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Thanks, fix folded to the patch as it's still in the development branch.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-06-08 21:21 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-08 2:12 [PATCH -next] btrfs: sysfs: fix return value check in btrfs_force_chunk_alloc_s() Wei Yongjun
2022-06-08 21:17 ` David Sterba
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.