Fix thread name buffer overflow.

MFC after:	1 week
This commit is contained in:
Alexander Motin 2019-04-12 18:13:57 +00:00
parent b8f75b175c
commit cfe60d67ae
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=346159

View File

@ -634,7 +634,7 @@ pci_vtscsi_init_queue(struct pci_vtscsi_softc *sc,
struct pci_vtscsi_queue *queue, int num)
{
struct pci_vtscsi_worker *worker;
char threadname[16];
char tname[MAXCOMLEN + 1];
int i;
queue->vsq_sc = sc;
@ -653,8 +653,8 @@ pci_vtscsi_init_queue(struct pci_vtscsi_softc *sc,
pthread_create(&worker->vsw_thread, NULL, &pci_vtscsi_proc,
(void *)worker);
sprintf(threadname, "virtio-scsi:%d-%d", num, i);
pthread_set_name_np(worker->vsw_thread, threadname);
snprintf(tname, sizeof(tname), "vtscsi:%d-%d", num, i);
pthread_set_name_np(worker->vsw_thread, tname);
LIST_INSERT_HEAD(&queue->vsq_workers, worker, vsw_link);
}