According to Linux and QEMU, s/n equal to buffer is not zero-terminated.

This makes same s/n reported for both virtio and AHCI drivers.

MFC after:	2 weeks
This commit is contained in:
Alexander Motin 2015-03-15 17:45:16 +00:00
parent 207e72288c
commit 811a355f1a
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=280044

View File

@ -263,7 +263,9 @@ pci_vtblk_proc(struct pci_vtblk_softc *sc, struct vqueue_info *vq)
break;
case VBH_OP_IDENT:
/* Assume a single buffer */
strlcpy(iov[1].iov_base, sc->vbsc_ident,
/* S/n equal to buffer is not zero-terminated. */
memset(iov[1].iov_base, 0, iov[1].iov_len);
strncpy(iov[1].iov_base, sc->vbsc_ident,
MIN(iov[1].iov_len, sizeof(sc->vbsc_ident)));
pci_vtblk_done(&io->io_req, 0);
return;