]> git.ipfire.org Git - thirdparty/qemu.git/commit
hw/ufs: Fix potential bugs in MMIO read|write
authorMinwoo Im <minwoo.im.dev@gmail.com>
Sun, 23 Jun 2024 02:45:55 +0000 (11:45 +0900)
committerJeuk Kim <jeuk20.kim@samsung.com>
Sun, 30 Jun 2024 03:44:32 +0000 (12:44 +0900)
commite12b11f6f29272ee31ccde6b0db1a10139e87083
tree69874baaafe6b580fdaf1d36a5dc1837b12bd0f9
parent3665dd6bb9043bef181c91e2dce9e1efff47ed51
hw/ufs: Fix potential bugs in MMIO read|write

This patch fixes two points reported in coverity scan report [1].  Check
the MMIO access address with (addr + size), not just with the start offset
addr to make sure that the requested memory access not to exceed the
actual register region.  We also updated (uint8_t *) to (uint32_t *) to
represent we are accessing the MMIO registers by dword-sized only.

[1] https://lore.kernel.org/qemu-devel/CAFEAcA82L-WZnHMW0X+Dr40bHM-EVq2ZH4DG4pdqop4xxDP2Og@mail.gmail.com/

Cc: Jeuk Kim <jeuk20.kim@gmail.com>
Reported-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Minwoo Im <minwoo.im.dev@gmail.com>
Reviewed-by: Jeuk Kim <jeuk20.kim@samsung.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-Id: <20240623024555.78697-1-minwoo.im.dev@gmail.com>
Signed-off-by: Jeuk Kim <jeuk20.kim@samsung.com>
hw/ufs/ufs.c