Re: [PATCH v10 1/3] scsi: sd: Fix build warning in sd_revalidate_disk()

From: Damien Le Moal
Date: Tue Aug 26 2025 - 01:11:06 EST


On 8/26/25 03:39, Abinash Singh wrote:
> 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@xxxxxxxxxxxxxxx
> Reviewed-by: Bart Van Assche <bvanassche@xxxxxxx>
> Signed-off-by: Abinash Singh <abinashsinghlalotra@xxxxxxxxx>

Reviewed-by: Damien Le Moal <dlemoal@xxxxxxxxxx>


--
Damien Le Moal
Western Digital Research