qemu/hw/misc
Hao Wu 1e5ce6e10a hw/misc: Fix arith overflow in NPCM7XX PWM module
Fix potential overflow problem when calculating pwm_duty.
1. Ensure p->cmr and p->cnr to be from [0,65535], according to the
   hardware specification.
2. Changed duty to uint32_t. However, since MAX_DUTY * (p->cmr+1)
   can excceed UINT32_MAX, we convert them to uint64_t in computation
   and converted them back to uint32_t.
   (duty is guaranteed to be <= MAX_DUTY so it won't overflow.)

Fixes: CID 1442342
Suggested-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Doug Evans <dje@google.com>
Signed-off-by: Hao Wu <wuhaotsh@google.com>
Message-id: 20210127011142.2122790-1-wuhaotsh@google.com
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2021-01-29 10:47:28 +00:00
..
macio macio: don't set user_creatable to false 2021-01-13 12:21:21 +00:00
a9scu.c hw/misc/a9scu: Report unimplemented accesses with qemu_log_mask(UNIMP) 2020-09-14 14:23:19 +01:00
allwinner-cpucfg.c
allwinner-h3-ccu.c
allwinner-h3-dramc.c hw/misc/allwinner-h3-dramc: enforce 64-bit multiply when calculating row mirror address 2020-03-30 13:18:58 +01:00
allwinner-h3-sysctrl.c
allwinner-sid.c qdev: Move softmmu properties to qdev-properties-system.h 2020-12-18 15:20:17 -05:00
applesmc.c nomaintainer: Fix Lesser GPL version number 2020-11-15 17:04:40 +01:00
arm11scu.c
arm_integrator_debug.c Use OBJECT_DECLARE_SIMPLE_TYPE when possible 2020-09-18 14:12:32 -04:00
arm_l2x0.c Use OBJECT_DECLARE_SIMPLE_TYPE when possible 2020-09-18 14:12:32 -04:00
arm_sysctl.c Use OBJECT_DECLARE_SIMPLE_TYPE when possible 2020-09-18 14:12:32 -04:00
armsse-cpuid.c
armsse-mhu.c
aspeed_scu.c misc: aspeed_scu: Update AST2600 silicon id register 2020-09-18 09:04:36 +02:00
aspeed_sdmc.c aspeed/sdmc: Simplify calculation of RAM bits 2020-09-01 14:21:51 +02:00
aspeed_xdma.c
auxbus.c auxbus: Move QOM macros to header 2020-08-27 14:04:55 -04:00
avr_power.c hw/misc: avr: Add limited support for power reduction device 2020-07-11 11:02:05 +02:00
bcm2835_cprman.c hw/misc/bcm2835_cprman: add sane reset values to the registers 2020-10-27 11:10:44 +00:00
bcm2835_mbox.c qom: Don't handle impossible object_property_get_link() failure 2020-07-10 15:18:08 +02:00
bcm2835_mphi.c raspi: add BCM2835 SOC MPHI emulation 2020-06-05 17:23:09 +01:00
bcm2835_property.c qom: Don't handle impossible object_property_get_link() failure 2020-07-10 15:18:08 +02:00
bcm2835_rng.c
bcm2835_thermal.c
cbus.c
debugexit.c Use OBJECT_DECLARE_SIMPLE_TYPE when possible 2020-09-18 14:12:32 -04:00
eccmemctl.c Use OBJECT_DECLARE_SIMPLE_TYPE when possible 2020-09-18 14:12:32 -04:00
edu.c qemu/atomic.h: rename atomic_ to qatomic_ 2020-09-23 16:07:44 +01:00
emc141x.c hw/misc: add an EMC141{3,4} device model 2020-12-10 12:11:03 +01:00
empty_slot.c Use OBJECT_DECLARE_SIMPLE_TYPE when possible 2020-09-18 14:12:32 -04:00
exynos4210_clk.c Use OBJECT_DECLARE_SIMPLE_TYPE when possible 2020-09-18 14:12:32 -04:00
exynos4210_pmu.c Use OBJECT_DECLARE_SIMPLE_TYPE when possible 2020-09-18 14:12:32 -04:00
exynos4210_rng.c Use OBJECT_DECLARE_SIMPLE_TYPE when possible 2020-09-18 14:12:32 -04:00
grlib_ahb_apb_pnp.c hw/misc/grlib_ahb_apb_pnp: Add trace events on read accesses 2020-06-09 09:21:10 +02:00
imx6_ccm.c hw/msic: imx6_ccm: Correct register value for silicon type 2021-01-08 15:13:39 +00:00
imx6_src.c i.MX6: Fix bad printf format specifiers 2020-12-10 11:44:55 +00:00
imx6ul_ccm.c i.MX6ul: Fix bad printf format specifiers 2020-12-10 11:44:55 +00:00
imx7_ccm.c
imx7_gpr.c
imx7_snvs.c
imx25_ccm.c i.MX25: Fix bad printf format specifiers 2020-12-10 11:44:55 +00:00
imx31_ccm.c i.MX31: Fix bad printf format specifiers 2020-12-10 11:44:55 +00:00
imx_ccm.c i.MX31: Fix bad printf format specifiers 2020-12-10 11:44:55 +00:00
imx_rngc.c
iotkit-secctl.c
iotkit-sysctl.c qom: simplify object_find_property / object_class_find_property 2020-09-22 16:45:16 -04:00
iotkit-sysinfo.c
ivshmem.c qdev: Move softmmu properties to qdev-properties-system.h 2020-12-18 15:20:17 -05:00
Kconfig hw/misc: add an EMC141{3,4} device model 2020-12-10 12:11:03 +01:00
led.c hw/misc/led: Emit a trace event when LED intensity has changed 2020-10-26 13:44:58 +01:00
mac_via.c qdev: Move softmmu properties to qdev-properties-system.h 2020-12-18 15:20:17 -05:00
max111x.c hw/ssi: Rename SSI 'slave' as 'peripheral' 2020-12-10 12:15:03 -05:00
mchp_pfsoc_dmc.c hw/misc: Add Microchip PolarFire SoC DDR Memory Controller support 2020-11-03 07:17:23 -08:00
mchp_pfsoc_ioscb.c hw/misc: Add Microchip PolarFire SoC IOSCB module support 2020-11-03 07:17:23 -08:00
mchp_pfsoc_sysreg.c hw/misc: Add Microchip PolarFire SoC SYSREG module support 2020-11-03 07:17:23 -08:00
meson.build hw/misc: Add a PWM module for NPCM7XX 2021-01-12 21:19:02 +00:00
milkymist-hpdmc.c nomaintainer: Fix Lesser GPL version number 2020-11-15 17:04:40 +01:00
milkymist-pfpu.c nomaintainer: Fix Lesser GPL version number 2020-11-15 17:04:40 +01:00
mips_cmgcr.c
mips_cpc.c hw/mips: Fix Lesser GPL version number 2020-11-03 16:51:13 +01:00
mips_itu.c hw/mips: Fix Lesser GPL version number 2020-11-03 16:51:13 +01:00
mos6522.c misc/mos6522: Use timer_free() in the finalize function to avoid memleak 2021-01-18 11:51:26 +01:00
mps2-fpgaio.c hw/misc/mps2-fpgaio: Use the LED device 2020-10-26 13:44:58 +01:00
mps2-scc.c hw/misc/mps2-scc: Use the LED device 2020-10-26 13:44:58 +01:00
msf2-sysreg.c
mst_fpga.c Use OBJECT_DECLARE_SIMPLE_TYPE when possible 2020-09-18 14:12:32 -04:00
npcm7xx_clk.c hw/*: Use type casting for SysBusDevice in NPCM7XX 2021-01-12 21:19:02 +00:00
npcm7xx_gcr.c hw/*: Use type casting for SysBusDevice in NPCM7XX 2021-01-12 21:19:02 +00:00
npcm7xx_pwm.c hw/misc: Fix arith overflow in NPCM7XX PWM module 2021-01-29 10:47:28 +00:00
npcm7xx_rng.c hw/*: Use type casting for SysBusDevice in NPCM7XX 2021-01-12 21:19:02 +00:00
nrf51_rng.c
omap_clk.c
omap_gpmc.c
omap_l4.c
omap_sdrc.c
omap_tap.c
pc-testdev.c Use OBJECT_DECLARE_SIMPLE_TYPE when possible 2020-09-18 14:12:32 -04:00
pca9552.c Use DECLARE_*CHECKER* macros 2020-09-09 09:27:09 -04:00
pci-testdev.c Use OBJECT_DECLARE_SIMPLE_TYPE when possible 2020-09-18 14:12:32 -04:00
puv3_pm.c Use OBJECT_DECLARE_SIMPLE_TYPE when possible 2020-09-18 14:12:32 -04:00
pvpanic.c pvpanic: Advertise the PVPANIC_CRASHLOADED event support 2020-11-11 03:59:05 -05:00
sbsa_ec.c hw/misc/sbsa_ec : Add an embedded controller for sbsa-ref 2020-09-01 14:01:12 +01:00
sga.c Use OBJECT_DECLARE_SIMPLE_TYPE when possible 2020-09-18 14:12:32 -04:00
sifive_e_prci.c hw/riscv: Move sifive_e_prci model to hw/misc 2020-09-09 15:54:19 -07:00
sifive_test.c hw/riscv: Move sifive_test model to hw/misc 2020-09-09 15:54:19 -07:00
sifive_u_otp.c block: Separate blk_is_writable() and blk_supports_write_perm() 2021-01-27 20:45:20 +01:00
sifive_u_prci.c hw/riscv: Move sifive_u_prci model to hw/misc 2020-09-09 15:54:19 -07:00
slavio_misc.c Use OBJECT_DECLARE_SIMPLE_TYPE when possible 2020-09-18 14:12:32 -04:00
stm32f2xx_syscfg.c hw/misc/stm32f2xx_syscfg: Remove extraneous IRQ 2020-11-10 11:03:48 +00:00
stm32f4xx_exti.c
stm32f4xx_syscfg.c
tmp105.c tmp105: Correct handling of temperature limit checks 2020-11-17 12:56:33 +00:00
tmp105.h tmp105: Correct handling of temperature limit checks 2020-11-17 12:56:33 +00:00
tmp421.c tmp421: Register properties as class properties 2020-12-14 14:25:44 -05:00
trace-events hw/misc: Add a PWM module for NPCM7XX 2021-01-12 21:19:02 +00:00
trace.h trace: switch position of headers to what Meson requires 2020-08-21 06:18:24 -04:00
tz-mpc.c memory: Add IOMMUTLBEvent 2020-12-08 13:48:57 -05:00
tz-msc.c
tz-ppc.c
unimp.c hw/misc/unimp: Display the offset with width of the region size 2020-08-28 10:02:46 +01:00
vmcoreinfo.c
zynq_slcr.c hw/misc/zynq_slcr: Avoid #DIV/0! error 2020-12-15 13:36:45 +00:00
zynq-xadc.c