fix bug in block-qcow2.c:alloc_cluster_offset() (Shahar Frank)

During the debugging of the new revision of the zero dedup patch I
stepped on the following bug in block-qcow2.c:alloc_cluster_offset(). I
am not sure what the exact damage this bug can do, but it may be very
nasty because you way not notice it effects until you will do some
snapshot operations or similar actions that rely on the reference
counting.

The bug is easy to spot using the new "check" verb I added to the
qemu-img in one of the previous patches. I will resend the qemu-img
patch again with the new version of the zero dedup.

Signed-off-by: Shahar Frank <shaharf@qumranet.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>



git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5313 c046a42c-6fe2-441c-8c8c-71466251a162
1 file changed
tree: d1f80ea8e2dda8a5c1c52f6a29c06b46d808ae43
  1. audio/
  2. darwin-user/
  3. fpu/
  4. hw/
  5. keymaps/
  6. linux-user/
  7. pc-bios/
  8. slirp/
  9. target-alpha/
  10. target-arm/
  11. target-cris/
  12. target-i386/
  13. target-m68k/
  14. target-mips/
  15. target-ppc/
  16. target-sh4/
  17. target-sparc/
  18. tcg/
  19. tests/
  20. .gitignore
  21. a.out.h
  22. aes.c
  23. aes.h
  24. aio.c
  25. alpha-dis.c
  26. alpha.ld
  27. arm-dis.c
  28. arm-semi.c
  29. arm.ld
  30. block-bochs.c
  31. block-cloop.c
  32. block-cow.c
  33. block-dmg.c
  34. block-nbd.c
  35. block-parallels.c
  36. block-qcow.c
  37. block-qcow2.c
  38. block-raw-posix.c
  39. block-raw-win32.c
  40. block-vmdk.c
  41. block-vpc.c
  42. block-vvfat.c
  43. block.c
  44. block.h
  45. block_int.h
  46. bswap.h
  47. Changelog
  48. check_ops.sh
  49. cocoa.m
  50. compatfd.c
  51. compatfd.h
  52. configure
  53. console.c
  54. console.h
  55. COPYING
  56. COPYING.LIB
  57. cpu-all.h
  58. cpu-defs.h
  59. cpu-exec.c
  60. cris-dis.c
  61. curses.c
  62. curses_keys.h
  63. cutils.c
  64. d3des.c
  65. d3des.h
  66. dis-asm.h
  67. disas.c
  68. disas.h
  69. dyngen-exec.h
  70. dyngen.c
  71. elf.h
  72. elf_ops.h
  73. exec-all.h
  74. exec.c
  75. gdbstub.c
  76. gdbstub.h
  77. gen-icount.h
  78. host-utils.c
  79. host-utils.h
  80. hostregs_helper.h
  81. hpet.h
  82. hppa-dis.c
  83. hppa.ld
  84. i386-dis.c
  85. i386.ld
  86. ia64.ld
  87. keymaps.c
  88. kqemu.c
  89. kqemu.h
  90. LICENSE
  91. loader.c
  92. m68k-dis.c
  93. m68k-semi.c
  94. m68k.ld
  95. MAINTAINERS
  96. Makefile
  97. Makefile.target
  98. mips-dis.c
  99. mips.ld
  100. mipsel.ld
  101. monitor.c
  102. nbd.c
  103. nbd.h
  104. net-checksum.c
  105. net.h
  106. osdep.c
  107. osdep.h
  108. ppc-dis.c
  109. ppc.ld
  110. ppc64.ld
  111. qemu-aio.h
  112. qemu-binfmt-conf.sh
  113. qemu-char.h
  114. qemu-common.h
  115. qemu-doc.texi
  116. qemu-img.c
  117. qemu-img.texi
  118. qemu-lock.h
  119. qemu-log.h
  120. qemu-malloc.c
  121. qemu-nbd.c
  122. qemu-nbd.texi
  123. qemu-tech.texi
  124. qemu-timer.h
  125. qemu-tool.c
  126. qemu_socket.h
  127. readline.c
  128. README
  129. s390-dis.c
  130. s390.ld
  131. sdl.c
  132. sdl_keysym.h
  133. sh4-dis.c
  134. softmmu-semi.h
  135. softmmu_defs.h
  136. softmmu_exec.h
  137. softmmu_header.h
  138. softmmu_template.h
  139. sparc-dis.c
  140. sparc.ld
  141. sparc64.ld
  142. sys-queue.h
  143. sysemu.h
  144. tap-win32.c
  145. texi2pod.pl
  146. thunk.c
  147. thunk.h
  148. TODO
  149. translate-all.c
  150. uboot_image.h
  151. usb-linux.c
  152. VERSION
  153. vgafont.h
  154. vl.c
  155. vnc.c
  156. vnc_keysym.h
  157. vnchextile.h
  158. x86_64.ld
  159. x_keymap.c