[lvc-project] [Spam] [Spam] [PATCH 5.10] scsi: gdth: ensure event string is NUL-terminated
Fedor Pchelkin
pchelkin at ispras.ru
Tue Aug 18 18:27:57 MSK 2026
On Tue, 18. Aug 15:41, Daniil Iskhakov wrote:
> No upstream commit exists for this patch. GDT driver was removed from
> kernel in commit 0653c358d2dc ("scsi: Drop gdth driver").
>
> For GDT_PCIMPR controllers, the driver copies up to 256 bytes from the
> controller event buffer and later handles the result as a C string.
>
> If the firmware does not provide a NUL byte within the buffer,
> gdth_log_event() may read beyond event_string through printk() and
> sprintf().
>
> Force the last byte of event_string to NUL after copying it from the
> controller. This preserves shorter strings and safely truncates an
> unterminated full-length event.
>
> Found by Linux Verification Center (linuxtesting.org) with SVACE.
>
> Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
> Co-developed-by: Agalakov Daniil <ade at amicon.ru>
> Signed-off-by: Agalakov Daniil <ade at amicon.ru>
> Signed-off-by: Daniil Iskhakov <dish at amicon.ru>
> ---
А, это был патч, который почему-то дважды пометился [spam][spam], понял.
Если дописываете комментарии к патчу, это стоит делать вот прямо здесь
после трёх чёрточек ---. После diff это делать не надо.
> @@ -2562,6 +2562,7 @@ static irqreturn_t __gdth_interrupt(gdth_ha_str *ha,
> if (ha->dvr.event_string[i] == 0)
> break;
> }
> + ha->dvr.event_string[255] = 0;
Здесь оно как-то неправильно всё равно сдвинуто относительно верхней и
нижней фигурной скобок, если посмотреть. Патч из начала треда в этом
плане получше.. Добавляю его + в описание про коммит.
More information about the lvc-project
mailing list