qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCHv4 01/11] virtio-serial-bus: use correct lengths


From: Anthony Liguori
Subject: Re: [Qemu-devel] [PATCHv4 01/11] virtio-serial-bus: use correct lengths in control_out() message
Date: Fri, 16 Mar 2012 11:12:20 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0.2) Gecko/20120216 Thunderbird/10.0.2

On 03/15/2012 04:00 PM, Michael Tokarev wrote:
In case of more than one control message, the code will use
size of the largest message so far for all subsequent messages,
instead of using size of current one.  Fix it.

Signed-off-by: Michael Tokarev<address@hidden>
---
  hw/virtio-serial-bus.c |    6 +++---
  1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/hw/virtio-serial-bus.c b/hw/virtio-serial-bus.c
index e22940e..abe48ec 100644
--- a/hw/virtio-serial-bus.c
+++ b/hw/virtio-serial-bus.c
@@ -454,7 +454,7 @@ static void control_out(VirtIODevice *vdev, VirtQueue *vq)
      len = 0;
      buf = NULL;
      while (virtqueue_pop(vq,&elem)) {
-        size_t cur_len, copied;
+        size_t cur_len;

          cur_len = iov_size(elem.out_sg, elem.out_num);
          /*
@@ -467,9 +467,9 @@ static void control_out(VirtIODevice *vdev, VirtQueue *vq)
              buf = g_malloc(cur_len);
              len = cur_len;
          }
-        copied = iov_to_buf(elem.out_sg, elem.out_num, buf, 0, len);
+        iov_to_buf(elem.out_sg, elem.out_num, buf, 0, cur_len);

I don't understand what this is fixing. copied = cur_len unless for some reason a full copy couldn't be done.

But you're assuming a full copy is done. So I'm confused by what is being fixed here.

Regards,

Anthony Liguori

-        handle_control_message(vser, buf, copied);
+        handle_control_message(vser, buf, cur_len);
          virtqueue_push(vq,&elem, 0);
      }
      g_free(buf);




reply via email to

[Prev in Thread] Current Thread [Next in Thread]