diff options
author | Dmitry Antipov <dmantipov@yandex.ru> | 2023-12-21 11:47:45 +0300 |
---|---|---|
committer | Seung-Woo Kim <sw0312.kim@samsung.com> | 2024-07-01 16:49:51 +0900 |
commit | 9af1b3f51acda7b3ad01081ed8479eebe3bb6fe7 (patch) | |
tree | dd7dd3776df64bda78b84660734ac9ab28cc637e | |
parent | 6b316c3e03956c308357525356a07e680116bccc (diff) | |
download | linux-rpi-9af1b3f51acda7b3ad01081ed8479eebe3bb6fe7.tar.gz linux-rpi-9af1b3f51acda7b3ad01081ed8479eebe3bb6fe7.tar.bz2 linux-rpi-9af1b3f51acda7b3ad01081ed8479eebe3bb6fe7.zip |
btrfs: fix kvcalloc() arguments order in btrfs_ioctl_send()
commit 6ff09b6b8c2fb6b3edda4ffaa173153a40653067 upstream.
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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
[sw0312.kim: cherry-pick stable linux-6.6.y commit 0b76a4f72362 to resolve gcc-14 warning]
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Change-Id: Ic13636aefb3e67bec305510f6478d7f370cca8a1
-rw-r--r-- | fs/btrfs/send.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/btrfs/send.c b/fs/btrfs/send.c index db94eefda27e..c367b1f0fc0b 100644 --- a/fs/btrfs/send.c +++ b/fs/btrfs/send.c @@ -8205,8 +8205,8 @@ long btrfs_ioctl_send(struct inode *inode, struct btrfs_ioctl_send_args *arg) goto out; } - sctx->clone_roots = kvcalloc(sizeof(*sctx->clone_roots), - arg->clone_sources_count + 1, + sctx->clone_roots = kvcalloc(arg->clone_sources_count + 1, + sizeof(*sctx->clone_roots), GFP_KERNEL); if (!sctx->clone_roots) { ret = -ENOMEM; |