On 26.03.2014 13:05, Stefan Hajnoczi wrote:
It is not necessary to check errno for EINTR and the block layer does
not produce short reads.  Therefore we can drop the loop that attempts
to read a compressed chunk.

The loop is buggy because it incorrectly adds the transferred bytes
twice:

   do {
       ret = bdrv_pread(...);
       i += ret;
   } while (ret >= 0 && ret + i < s->lengths[chunk]);

Luckily we can drop the loop completely and perform a single
bdrv_pread().

Signed-off-by: Stefan Hajnoczi <stefa...@redhat.com>
Signed-off-by: Kevin Wolf <kw...@redhat.com>
---
  block/dmg.c | 15 ++-------------
  1 file changed, 2 insertions(+), 13 deletions(-)

Reviewed-by: Max Reitz <mre...@redhat.com>

Reply via email to