]> git.ipfire.org Git - thirdparty/qemu.git/commit
hw/ufs: Fix mcq register range check logic
authorJeuk Kim <jeuk20.kim@samsung.com>
Tue, 9 Jul 2024 11:53:49 +0000 (20:53 +0900)
committerJeuk Kim <jeuk20.kim@samsung.com>
Sun, 14 Jul 2024 08:11:21 +0000 (17:11 +0900)
commit50475f1511964775ff73c2b07239c3ff571f75cd
tree58a7d2bd4cd31aa0ba4959a006c09b1da2cb2f14
parent37fbfda8f4145ba1700f63f0cb7be4c108d545de
hw/ufs: Fix mcq register range check logic

The function ufs_is_mcq_reg() and ufs_is_mcq_op_reg() only evaluated
the range of the mcq_reg and mcq_op_reg offset, which is defined as
a constant. Therefore, it was possible for them to return true
even though the ufs device is configured to not support the mcq.
This could cause ufs_mmio_read()/ufs_mmio_write() to result in
Null-pointer-dereference.
So fix it.

Resolves: #2428
Fixes: 5c079578d2e4 ("hw/ufs: Add support MCQ of UFSHCI 4.0")
Reported-by: Zheyu Ma <zheyuma97@gmail.com>
Signed-off-by: Jeuk Kim <jeuk20.kim@samsung.com>
Reviewed-by: Minwoo Im <minwoo.im@samsung.com>
hw/ufs/ufs.c