diff options
author | Jeuk Kim <jeuk20.kim@samsung.com> | 2023-09-18 10:02:36 +0900 |
---|---|---|
committer | Jeuk Kim <jeuk20.kim@samsung.com> | 2023-10-13 13:56:28 +0900 |
commit | 97970dae534226f045ff08c77bdb8a25e19fa023 (patch) | |
tree | 4780b2eb46a658c28186c59fcbc1e4c3f3f8b619 /tests | |
parent | 63011373ad22c794a013da69663c03f1297a5c56 (diff) |
hw/ufs: Fix code coverity issues
Fixed four ufs-related coverity issues.
The coverity issues and fixes are as follows
1. CID 1519042: Security issue with the rand() function
Changed to use a fixed value (0xab) instead of rand() as
the value for testing
2. CID 1519043: Dereference after null check
Removed useless (redundant) null checks
3. CID 1519050: Out-of-bounds access issue
Fix to pass an array type variable to find_first_bit and
find_next_bit using DECLARE_BITMAP()
4. CID 1519051: Out-of-bounds read issue
Fix incorrect range check for lun
Fix coverity CID: 1519042 1519043 1519050 1519051
Signed-off-by: Jeuk Kim <jeuk20.kim@samsung.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/qtest/ufs-test.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/tests/qtest/ufs-test.c b/tests/qtest/ufs-test.c index ed3dbca154..15d467630c 100644 --- a/tests/qtest/ufs-test.c +++ b/tests/qtest/ufs-test.c @@ -497,7 +497,7 @@ static void ufstest_read_write(void *obj, void *data, QGuestAllocator *alloc) g_assert_cmpuint(block_size, ==, 4096); /* Write data */ - memset(write_buf, rand() % 255 + 1, block_size); + memset(write_buf, 0xab, block_size); ufs_send_scsi_command(ufs, 0, 1, write_cdb, write_buf, block_size, NULL, 0, &utrd, &rsp_upiu); g_assert_cmpuint(le32_to_cpu(utrd.header.dword_2), ==, UFS_OCS_SUCCESS); |