]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
5.15-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 13 May 2024 10:10:13 +0000 (12:10 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 13 May 2024 10:10:13 +0000 (12:10 +0200)
added patches:
btrfs-fix-kvcalloc-arguments-order-in-btrfs_ioctl_send.patch

queue-5.15/btrfs-fix-kvcalloc-arguments-order-in-btrfs_ioctl_send.patch [new file with mode: 0644]
queue-5.15/series

diff --git a/queue-5.15/btrfs-fix-kvcalloc-arguments-order-in-btrfs_ioctl_send.patch b/queue-5.15/btrfs-fix-kvcalloc-arguments-order-in-btrfs_ioctl_send.patch
new file mode 100644 (file)
index 0000000..28629c4
--- /dev/null
@@ -0,0 +1,43 @@
+From 6ff09b6b8c2fb6b3edda4ffaa173153a40653067 Mon Sep 17 00:00:00 2001
+From: Dmitry Antipov <dmantipov@yandex.ru>
+Date: Thu, 21 Dec 2023 11:47:45 +0300
+Subject: btrfs: fix kvcalloc() arguments order in btrfs_ioctl_send()
+
+From: Dmitry Antipov <dmantipov@yandex.ru>
+
+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>
+---
+ fs/btrfs/send.c |    4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+--- a/fs/btrfs/send.c
++++ b/fs/btrfs/send.c
+@@ -7612,8 +7612,8 @@ long btrfs_ioctl_send(struct file *mnt_f
+       sctx->waiting_dir_moves = RB_ROOT;
+       sctx->orphan_dirs = RB_ROOT;
+-      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;
index 9f5ebbd92ea942b29376d3aa1b79dbb96239bc29..2b3ab38402dae1a96c9c25bd5d1e3c7105517f90 100644 (file)
@@ -140,3 +140,4 @@ drm-amd-display-atom-integrated-system-info-v2_2-for.patch
 revert-revert-acpi-cppc-use-access_width-over-bit_wi.patch
 acpi-cppc-fix-bit_offset-shift-in-mask_val-macro.patch
 acpi-cppc-fix-access-width-used-for-pcc-registers.patch
+btrfs-fix-kvcalloc-arguments-order-in-btrfs_ioctl_send.patch