Skip to content

Commit 6ff09b6

Browse files
dmantipovkdave
authored andcommitted
btrfs: fix kvcalloc() arguments order in btrfs_ioctl_send()
When compiling with gcc version 14.0.0 20231220 (experimental) and W=1, I've noticed the following warning: fs/btrfs/send.c: In function 'btrfs_ioctl_send': fs/btrfs/send.c:8208:44: warning: 'kvcalloc' sizes specified with 'sizeof' in the earlier argument and not in the later argument [-Wcalloc-transposed-args] 8208 | sctx->clone_roots = kvcalloc(sizeof(*sctx->clone_roots), | ^ Since 'n' and 'size' arguments of 'kvcalloc()' are multiplied to calculate the final size, their actual order doesn't affect the result and so this is not a bug. But it's still worth to fix it. Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
1 parent 02444f2 commit 6ff09b6

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

fs/btrfs/send.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8205,8 +8205,8 @@ long btrfs_ioctl_send(struct inode *inode, struct btrfs_ioctl_send_args *arg)
82058205
goto out;
82068206
}
82078207

8208-
sctx->clone_roots = kvcalloc(sizeof(*sctx->clone_roots),
8209-
arg->clone_sources_count + 1,
8208+
sctx->clone_roots = kvcalloc(arg->clone_sources_count + 1,
8209+
sizeof(*sctx->clone_roots),
82108210
GFP_KERNEL);
82118211
if (!sctx->clone_roots) {
82128212
ret = -ENOMEM;

0 commit comments

Comments
 (0)