On 09/20/2012 01:17 AM, Dave Young wrote:
> For virtio block device, if user does not specify the serial attribute,
> There will be not serial availabe, this is not convinient for identify

s/not serial availabe/no serial available/
s/convinient/convenient/
s/identify/identifying/

> the disk.
> 
> Doing something similar to ide disks, add a "VD0000?" default serial
> number if user does not specify it.
> 
> Signed-off-by: Dave Young <dyo...@redhat.com>
> ---

>  
> +#define DEFAULT_VIRTIO_BLK_SERIAL_LEN 8

> +    char serial[DEFAULT_VIRTIO_BLK_SERIAL_LEN];
>  
>      if (req->elem.out_num < 1 || req->elem.in_num < 1) {
>          error_report("virtio-blk missing headers");
> @@ -388,12 +391,14 @@ static void virtio_blk_handle_request(Vi
>      } else if (type & VIRTIO_BLK_T_GET_ID) {
>          VirtIOBlock *s = req->dev;
>  
> +        snprintf(serial, DEFAULT_VIRTIO_BLK_SERIAL_LEN,
> +                 "VD%05d", s->drive_serial);

So if I cycle through hotplug and unplug for 100000 times, my string
will now be silently truncated, and I can end up with disks with shared
serial numbers?

-- 
Eric Blake   ebl...@redhat.com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to