scsi-generic: keep VPD page list sorted
commit6c219fc8a112fc69b29f59ea2c7865717ff6e3e0
authorPaolo Bonzini <pbonzini@redhat.com>
Mon, 22 Oct 2018 22:46:21 +0000 (23 00:46 +0200)
committerPaolo Bonzini <pbonzini@redhat.com>
Tue, 6 Nov 2018 20:35:05 +0000 (6 21:35 +0100)
tree33a033ea082dc7f72f99597762be7ef140b89cae
parente58ccf039650065a9442de43c9816f81e88f27f6
scsi-generic: keep VPD page list sorted

Block limits emulation is just placing 0xb0 as the final byte of the
VPD pages list.  However, VPD page numbers must be sorted, so change
that to an in-place insert.  Since I couldn't find any disk that triggered
the loop more than once, this was tested by adding manually 0xb1
at the end of the list and checking that 0xb0 was added before.

Reported-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
hw/scsi/scsi-generic.c