The advantage of kcalloc is, that will prevent integer overflows which could
result from the multiplication of number of elements and size and it is also
a bit nicer to read.
The semantic patch that makes this change is available
in https://lkml.org/lkml/2011/11/25/107
Signed-off-by: Thomas
Signed-off-by: Thomas Meyer
---
diff -u -p a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -3296,10 +3296,7 @@ int btrfs_resume_balance_async(struct bt
}
tsk = kthread_run(balance_kthread, fs_info, "btrfs-balance");
Signed-off-by: Thomas Meyer
---
diff -u -p a/fs/btrfs/send.c b/fs/btrfs/send.c
--- a/fs/btrfs/send.c
+++ b/fs/btrfs/send.c
@@ -3429,10 +3429,9 @@ static int __find_xattr(int num, struct
strncmp(name, ctx->name, name_len) == 0) {
ctx->found_idx
Bool initializations should use true and false. Bool tests don't need
comparisons.
Signed-off-by: Thomas Meyer
---
diff -u -p a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -6958,7 +6958,7 @@ static int __btrfs_free_extent(s
The semantic patch that makes this change is available
in scripts/coccinelle/api/ptr_ret.cocci.
More information about semantic patching is available at
http://coccinelle.lip6.fr/
Signed-off-by: Thomas Meyer
---
diff -u -p a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
--- a/fs/btrfs/volumes.c