]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
ntb: reduce stack usage in idt_scan_mws
authorArnd Bergmann <arnd@arndb.de>
Fri, 21 Feb 2025 08:57:25 +0000 (09:57 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 2 May 2025 05:50:56 +0000 (07:50 +0200)
commit27f6ee168c00c4cd2d2b537f048155bbf2b6059c
tree5d400f468b6dccbb59df05902ba0d6fb5b5192ea
parent5d53e88d8370b9ab14dd830abb410d9a2671edb6
ntb: reduce stack usage in idt_scan_mws

[ Upstream commit aff12700b8dd7422bfe2277696e192af4df9de8f ]

idt_scan_mws() puts a large fixed-size array on the stack and copies
it into a smaller dynamically allocated array at the end. On 32-bit
targets, the fixed size can easily exceed the warning limit for
possible stack overflow:

drivers/ntb/hw/idt/ntb_hw_idt.c:1041:27: error: stack frame size (1032) exceeds limit (1024) in 'idt_scan_mws' [-Werror,-Wframe-larger-than]

Change it to instead just always use dynamic allocation for the
array from the start. It's too big for the stack, but not actually
all that much for a permanent allocation.

Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/all/202205111109.PiKTruEj-lkp@intel.com/
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Dave Jiang <dave.jiang@intel.com>
Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
Signed-off-by: Jon Mason <jdmason@kudzu.us>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/ntb/hw/idt/ntb_hw_idt.c