Re: [PATCH v2] scsi: proc: use snprintf() for the host name
From: Martin K. Petersen (Oracle)
Date: Wed Nov 25 2026 - 22:35:18 EST
On Tue, 10 Nov 2026 23:11:26 +0800, shao.mingyin@xxxxxxxxxx wrote:
> scsi_proc_host_add() and scsi_proc_host_rm() format shost->host_no into
> a 10-byte buffer with sprintf(). host_no is an unsigned int and can
> reach ten digits. The %d output plus the terminator then overflows the
> buffer, and a bounded format would truncate a ten-digit number to nine
> digits, colliding with an existing procfs entry.
>
> Widen the buffer to 11 bytes, use snprintf(), and print with %u to
> match the type. Ten-digit host numbers are written in full, the
> overflow is gone, and W=1 no longer reports -Wformat-truncation.
>
> [...]
Applied to 7.5/scsi-queue, thanks!
[1/1] scsi: proc: use snprintf() for the host name
https://git.kernel.org/mkp/scsi/c/f505b951db60
--
Martin K. Petersen