]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
xen/gntdev: remove struct gntdev_copy_batch from stack
authorJuergen Gross <jgross@suse.com>
Thu, 3 Jul 2025 07:32:59 +0000 (09:32 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 15 Aug 2025 10:04:58 +0000 (12:04 +0200)
commit2ee681584bdbd22499edee42db80a56152fba011
tree128929e2f62d3f53928f43a8f38ede6e8ba316f3
parent91ed8fc342d9307c1e8c18641c1b126069832cb2
xen/gntdev: remove struct gntdev_copy_batch from stack

[ Upstream commit 70045cf6593cbf0740956ea9b7b4269142c6ee38 ]

When compiling the kernel with LLVM, the following warning was issued:

  drivers/xen/gntdev.c:991: warning: stack frame size (1160) exceeds
  limit (1024) in function 'gntdev_ioctl'

The main reason is struct gntdev_copy_batch which is located on the
stack and has a size of nearly 1kb.

For performance reasons it shouldn't by just dynamically allocated
instead, so allocate a new instance when needed and instead of freeing
it put it into a list of free structs anchored in struct gntdev_priv.

Fixes: a4cdb556cae0 ("xen/gntdev: add ioctl for grant copy")
Reported-by: Abinash Singh <abinashsinghlalotra@gmail.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
Signed-off-by: Juergen Gross <jgross@suse.com>
Message-ID: <20250703073259.17356-1-jgross@suse.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/xen/gntdev-common.h
drivers/xen/gntdev.c