]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
scsi: sd: Fix build warning in sd_revalidate_disk()
authorAbinash Singh <abinashsinghlalotra@gmail.com>
Mon, 25 Aug 2025 18:39:38 +0000 (00:09 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 19 Oct 2025 14:33:53 +0000 (16:33 +0200)
commit4fbcd2bc60df11a7ad38b5542d2ae1a0e6dc4a77
tree79e5704f25e6b2b8c727f0902ca0da0bd4bd943b
parent7b2ef1a0a2f15a9579e0a0ec61877b56a05269b7
scsi: sd: Fix build warning in sd_revalidate_disk()

commit b5f717b31b5e478398740db8aee2ecbc4dd72bf3 upstream.

A build warning was triggered due to excessive stack usage in
sd_revalidate_disk():

drivers/scsi/sd.c: In function ‘sd_revalidate_disk.isra’:
drivers/scsi/sd.c:3824:1: warning: the frame size of 1160 bytes is larger than 1024 bytes [-Wframe-larger-than=]

This is caused by a large local struct queue_limits (~400B) allocated on
the stack. Replacing it with a heap allocation using kmalloc()
significantly reduces frame usage. Kernel stack is limited (~8 KB), and
allocating large structs on the stack is discouraged.  As the function
already performs heap allocations (e.g. for buffer), this change fits
well.

Fixes: 804e498e0496 ("sd: convert to the atomic queue limits API")
Cc: stable@vger.kernel.org
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Abinash Singh <abinashsinghlalotra@gmail.com>
Link: https://lore.kernel.org/r/20250825183940.13211-2-abinashsinghlalotra@gmail.com
Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/scsi/sd.c