On Thu, Oct 29, 2026 at 02:19:54PM +0100, Kevin Wolf wrote:
Am 29.10.2026 um 13:42 hat Stefan Hajnoczi geschrieben:
On Thu, Oct 29, 2026 at 12:24:00AM +0100, Kevin Wolf wrote:
Only 20 bytes are written to the passed buffer and the returned string doesn't have a NUL terminator.
Signed-off-by: Kevin Wolf <kwolf@redhat.com> --- tests/qtest/virtio-blk-test.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+)
diff --git a/tests/qtest/virtio-blk-test.c b/tests/qtest/virtio-blk-test.c index 14fadcb4009..99d785d9e1a 100644 --- a/tests/qtest/virtio-blk-test.c +++ b/tests/qtest/virtio-blk-test.c @@ -835,6 +835,25 @@ static void get_id_serial_short(void *obj, void *data, QGuestAllocator *t_alloc) qvirtqueue_cleanup(blk_if->vdev->bus, vq, t_alloc); }
+static void get_id_serial_short_trunc(void *obj, void *data, + QGuestAllocator *t_alloc) +{ + QVirtioBlk *blk_if = obj; + QVirtioDevice *dev = blk_if->vdev; + QVirtQueue *vq; + uint8_t status; + /* Everything after the 20 character maximum is untouched, no '\0' */ + const char expected[25] = "01234567890123456789\xa5\xa5\xa5\xa5\xa5";
get_id_request() also uses the 0xa5 byte pattern. How about using a different pattern like 0x5a here to distinguish the two?
This string is used to verify that the 0xa5 pattern set by get_id_request() is still unchanged after the request, so the whole point is that it is the same.
Ah, I see now. How about passing in a pattern_byte argument into get_id_request() so that the connection is explicit? Stefan