balloon: Fix overflow when reporting actual memory size

Beginning with its introduction, the virtio balloon has had an overflow error
that causes 'info balloon' to misreport the actual memory size when the balloon
itself becomes larger than 4G.  Use a cast when converting dev->actual from
pages to kB to prevent overflows.

Before:
(qemu) info balloon
balloon: actual=5120
(qemu) balloon 1025
(qemu) info balloon
balloon: actual=1025
(qemu) balloon 1024
(qemu) info balloon
balloon: actual=5120

After:
(qemu) info balloon
balloon: actual=5120
(qemu) balloon 1025
(qemu) info balloon
balloon: actual=1025
(qemu) balloon 1024
(qemu) info balloon
balloon: actual=1024

Signed-off-by: Adam Litke <agl@us.ibm.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
1 file changed
tree: 299225978d6c3bdf0ed6ce20580693e8d85deefd
  1. audio/
  2. block/
  3. bsd-user/
  4. darwin-user/
  5. default-configs/
  6. docs/
  7. fpu/
  8. gdb-xml/
  9. hw/
  10. linux-user/
  11. net/
  12. pc-bios/
  13. QMP/
  14. roms/
  15. slirp/
  16. sysconfigs/
  17. target-alpha/
  18. target-arm/
  19. target-cris/
  20. target-i386/
  21. target-m68k/
  22. target-microblaze/
  23. target-mips/
  24. target-ppc/
  25. target-s390x/
  26. target-sh4/
  27. target-sparc/
  28. tcg/
  29. tests/
  30. .gitignore
  31. .gitmodules
  32. a.out.h
  33. acl.c
  34. acl.h
  35. aes.c
  36. aes.h
  37. aio.c
  38. alpha-dis.c
  39. alpha.ld
  40. arm-dis.c
  41. arm-semi.c
  42. arm.ld
  43. async.c
  44. balloon.h
  45. block-migration.c
  46. block-migration.h
  47. block.c
  48. block.h
  49. block_int.h
  50. bswap.h
  51. bt-host.c
  52. bt-host.h
  53. bt-vhci.c
  54. buffered_file.c
  55. buffered_file.h
  56. cache-utils.c
  57. cache-utils.h
  58. Changelog
  59. check-qdict.c
  60. check-qfloat.c
  61. check-qint.c
  62. check-qjson.c
  63. check-qlist.c
  64. check-qstring.c
  65. cmd.c
  66. cmd.h
  67. cocoa.m
  68. CODING_STYLE
  69. config.h
  70. configure
  71. console.c
  72. console.h
  73. COPYING
  74. COPYING.LIB
  75. cpu-all.h
  76. cpu-common.h
  77. cpu-defs.h
  78. cpu-exec.c
  79. create_config
  80. cris-dis.c
  81. curses.c
  82. curses_keys.h
  83. cutils.c
  84. d3des.c
  85. d3des.h
  86. def-helper.h
  87. device_tree.c
  88. device_tree.h
  89. dis-asm.h
  90. disas.c
  91. disas.h
  92. dma-helpers.c
  93. dma.h
  94. dyngen-exec.h
  95. elf.h
  96. envlist.c
  97. envlist.h
  98. exec-all.h
  99. exec.c
  100. feature_to_c.sh
  101. gdbstub.c
  102. gdbstub.h
  103. gen-icount.h
  104. host-utils.c
  105. host-utils.h
  106. hpet.h
  107. hppa-dis.c
  108. hppa.ld
  109. hxtool
  110. i386-dis.c
  111. i386.ld
  112. ia64.ld
  113. input.c
  114. ioport-user.c
  115. ioport.c
  116. ioport.h
  117. json-lexer.c
  118. json-lexer.h
  119. json-parser.c
  120. json-parser.h
  121. json-streamer.c
  122. json-streamer.h
  123. keymaps.c
  124. keymaps.h
  125. kvm-all.c
  126. kvm.h
  127. libfdt_env.h
  128. LICENSE
  129. linux-aio.c
  130. m68k-dis.c
  131. m68k-semi.c
  132. m68k.ld
  133. MAINTAINERS
  134. Makefile
  135. Makefile.dis
  136. Makefile.hw
  137. Makefile.objs
  138. Makefile.target
  139. Makefile.user
  140. microblaze-dis.c
  141. migration-exec.c
  142. migration-fd.c
  143. migration-tcp.c
  144. migration-unix.c
  145. migration.c
  146. migration.h
  147. mips-dis.c
  148. mips.ld
  149. module.c
  150. module.h
  151. monitor.c
  152. monitor.h
  153. nbd.c
  154. nbd.h
  155. net-checksum.c
  156. net.c
  157. net.h
  158. notify.c
  159. notify.h
  160. osdep.c
  161. osdep.h
  162. path.c
  163. pci-ids.txt
  164. posix-aio-compat.c
  165. ppc-dis.c
  166. ppc.ld
  167. ppc64.ld
  168. qbool.c
  169. qbool.h
  170. qdict-test-data.txt
  171. qdict.c
  172. qdict.h
  173. qemu-aio.h
  174. qemu-barrier.h
  175. qemu-binfmt-conf.sh
  176. qemu-char.c
  177. qemu-char.h
  178. qemu-common.h
  179. qemu-config.c
  180. qemu-config.h
  181. qemu-doc.texi
  182. qemu-error.c
  183. qemu-error.h
  184. qemu-img-cmds.hx
  185. qemu-img.c
  186. qemu-img.texi
  187. qemu-io.c
  188. qemu-lock.h
  189. qemu-log.h
  190. qemu-malloc.c
  191. qemu-monitor.hx
  192. qemu-nbd.c
  193. qemu-nbd.texi
  194. qemu-objects.h
  195. qemu-option.c
  196. qemu-option.h
  197. qemu-options.hx
  198. qemu-queue.h
  199. qemu-sockets.c
  200. qemu-tech.texi
  201. qemu-thread.c
  202. qemu-thread.h
  203. qemu-timer.c
  204. qemu-timer.h
  205. qemu-tool.c
  206. qemu-x509.h
  207. qemu.sasl
  208. qemu_socket.h
  209. qerror.c
  210. qerror.h
  211. qfloat.c
  212. qfloat.h
  213. qint.c
  214. qint.h
  215. qjson.c
  216. qjson.h
  217. qlist.c
  218. qlist.h
  219. qobject.h
  220. qstring.c
  221. qstring.h
  222. readline.c
  223. readline.h
  224. README
  225. rules.mak
  226. rwhandler.c
  227. rwhandler.h
  228. s390-dis.c
  229. s390.ld
  230. savevm.c
  231. sdl.c
  232. sdl_keysym.h
  233. sdl_zoom.c
  234. sdl_zoom.h
  235. sdl_zoom_template.h
  236. sh4-dis.c
  237. softmmu-semi.h
  238. softmmu_defs.h
  239. softmmu_exec.h
  240. softmmu_header.h
  241. softmmu_template.h
  242. sparc-dis.c
  243. sparc.ld
  244. sparc64.ld
  245. sysemu.h
  246. targphys.h
  247. tcg-runtime.c
  248. texi2pod.pl
  249. thunk.c
  250. thunk.h
  251. TODO
  252. translate-all.c
  253. uboot_image.h
  254. usb-bsd.c
  255. usb-linux.c
  256. usb-stub.c
  257. VERSION
  258. vgafont.h
  259. vl.c
  260. vnc-auth-sasl.c
  261. vnc-auth-sasl.h
  262. vnc-auth-vencrypt.c
  263. vnc-auth-vencrypt.h
  264. vnc-tls.c
  265. vnc-tls.h
  266. vnc.c
  267. vnc.h
  268. vnc_keysym.h
  269. vnchextile.h
  270. x86_64.ld
  271. x_keymap.c
  272. x_keymap.h