char: cadence: check baud rate generator and divider values

The Cadence UART device emulator calculates speed by dividing the
baud rate by a 'baud rate generator' & 'baud rate divider' value.
The device specification defines these register values to be
non-zero and within certain limits. Add checks for these limits
to avoid errors like divide by zero.

Reported-by: Huawei PSIRT <psirt@huawei.com>
Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org>
Reviewed-by: Alistair Francis <alistair.francis@xilinx.com>
Message-id: 1477596278-1470-1-git-send-email-ppandit@redhat.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
1 file changed
tree: cac5e9d74f007697377fab6d54e6fbe0f2267d82
  1. .dir-locals.el
  2. .exrc
  3. .gitignore
  4. .gitmodules
  5. .mailmap
  6. .travis.yml
  7. CODING_STYLE
  8. COPYING
  9. COPYING.LIB
  10. Changelog
  11. HACKING
  12. LICENSE
  13. MAINTAINERS
  14. Makefile
  15. Makefile.objs
  16. Makefile.target
  17. README
  18. VERSION
  19. accel.c
  20. aio-posix.c
  21. aio-win32.c
  22. arch_init.c
  23. async.c
  24. atomic_template.h
  25. audio/
  26. backends/
  27. balloon.c
  28. block.c
  29. block/
  30. blockdev-nbd.c
  31. blockdev.c
  32. blockjob.c
  33. bootdevice.c
  34. bsd-user/
  35. bt-host.c
  36. bt-vhci.c
  37. configure
  38. contrib/
  39. cpu-exec-common.c
  40. cpu-exec.c
  41. cpus-common.c
  42. cpus.c
  43. cputlb.c
  44. crypto/
  45. default-configs/
  46. device-hotplug.c
  47. device_tree.c
  48. disas.c
  49. disas/
  50. dma-helpers.c
  51. docs/
  52. dump.c
  53. exec.c
  54. fpu/
  55. fsdev/
  56. gdb-xml/
  57. gdbstub.c
  58. hmp-commands-info.hx
  59. hmp-commands.hx
  60. hmp.c
  61. hmp.h
  62. hw/
  63. include/
  64. io/
  65. iohandler.c
  66. ioport.c
  67. iothread.c
  68. kvm-all.c
  69. kvm-stub.c
  70. libdecnumber/
  71. linux-headers/
  72. linux-user/
  73. main-loop.c
  74. memory.c
  75. memory_mapping.c
  76. migration/
  77. module-common.c
  78. monitor.c
  79. nbd/
  80. net/
  81. numa.c
  82. os-posix.c
  83. os-win32.c
  84. page_cache.c
  85. pc-bios/
  86. po/
  87. qapi-schema.json
  88. qapi/
  89. qdev-monitor.c
  90. qdict-test-data.txt
  91. qemu-bridge-helper.c
  92. qemu-char.c
  93. qemu-doc.texi
  94. qemu-ga.texi
  95. qemu-img-cmds.hx
  96. qemu-img.c
  97. qemu-img.texi
  98. qemu-io-cmds.c
  99. qemu-io.c
  100. qemu-nbd.c
  101. qemu-nbd.texi
  102. qemu-option-trace.texi
  103. qemu-options-wrapper.h
  104. qemu-options.h
  105. qemu-options.hx
  106. qemu-seccomp.c
  107. qemu-tech.texi
  108. qemu-timer.c
  109. qemu.nsi
  110. qemu.sasl
  111. qga/
  112. qmp.c
  113. qobject/
  114. qom/
  115. qtest.c
  116. replay/
  117. replication.c
  118. replication.h
  119. roms/
  120. rules.mak
  121. scripts/
  122. slirp/
  123. softmmu_template.h
  124. spice-qemu-char.c
  125. stubs/
  126. target-alpha/
  127. target-arm/
  128. target-cris/
  129. target-i386/
  130. target-lm32/
  131. target-m68k/
  132. target-microblaze/
  133. target-mips/
  134. target-moxie/
  135. target-openrisc/
  136. target-ppc/
  137. target-s390x/
  138. target-sh4/
  139. target-sparc/
  140. target-tilegx/
  141. target-tricore/
  142. target-unicore32/
  143. target-xtensa/
  144. tcg-runtime.c
  145. tcg/
  146. tci.c
  147. tests/
  148. thread-pool.c
  149. thunk.c
  150. tpm.c
  151. trace-events
  152. trace/
  153. translate-all.c
  154. translate-all.h
  155. translate-common.c
  156. ui/
  157. user-exec.c
  158. util/
  159. version.rc
  160. vl.c
  161. xen-common-stub.c
  162. xen-common.c
  163. xen-hvm-stub.c
  164. xen-hvm.c
  165. xen-mapcache.c