diff options
author | Zhihao Cheng <chengzhihao1@huawei.com> | 2019-06-14 20:18:16 +0800 |
---|---|---|
committer | David Oberhollenzer <david.oberhollenzer@sigma-star.at> | 2019-06-16 12:27:13 +0200 |
commit | d9ba215acdb7feddd7477470cc7c8498cb576f6b (patch) | |
tree | ee6f0b856a51bc05c5387188535f9f592c272f6b /tests/fs-tests/stress/atoms/stress_1.c | |
parent | c74c62420cbe1939c924e83f00e8838f148ae051 (diff) |
ubi-tests: io_read: Filter invalid offset value before 'lseek' in io_read test
There are many different offset values passed in 'lseek' during io_read
testing of ubi test. The offset value maybe a negative number or a big
number that exceeds the volume data size, which can lead to ubi tests
failure by passing invalid offset value to 'lseek'. For example:
Example 1: The data size of volume is 39525 bytes, offset = (sz) -
MAX_NAND_PAGE_SIZE - 1, where MAX_NAND_PAGE_SIZE is 65536. Here, offset
is a negative value passed to 'lseek', which leads to fail in io_read.
======================================================================
======================================================================
======================================================================
Test on mtdram, fastmap enabled, VID header offset factor 1
======================================================================
======================================================================
======================================================================
mtdram: 16MiB, PEB size 16KiB, fastmap enabled
Running mkvol_basic /dev/ubi0
Running mkvol_bad /dev/ubi0
Running mkvol_paral /dev/ubi0
Running rsvol /dev/ubi0
Running io_basic /dev/ubi0
Running io_read /dev/ubi0
[io_basic] test_read3():189: function seek() failed with error 22
(Invalid argument)
[io_basic] test_read3():190: len = 1
[io_basic] test_read2():237: offset = -26012
[io_basic] test_read1():303: length = 1
[io_basic] test_read():362: alignment = 7905
Error: io_read failed
FAILURE
Example 2: The data size of volume is 79035 bytes, offset = 2 *
MAX_NAND_PAGE_SIZE, where MAX_NAND_PAGE_SIZE is 65536. Here, offset is a
value exceeds volume size, which leads to fail in io_read.
======================================================================
======================================================================
======================================================================
Test on mtdram, fastmap enabled, VID header offset factor 1
======================================================================
======================================================================
======================================================================
mtdram: 16MiB, PEB size 16KiB, fastmap enabled
Running mkvol_basic /dev/ubi0
Running mkvol_bad /dev/ubi0
Running mkvol_paral /dev/ubi0
Running rsvol /dev/ubi0
Running io_basic /dev/ubi0
Running io_read /dev/ubi0
[io_basic] test_read3():185: function seek() failed with error 22
(Invalid argument)
[io_basic] test_read3():186: len = 1
[io_basic] test_read2():233: offset = 131072
[io_basic] test_read1():299: length = 1
[io_basic] test_read():358: alignment = 3
Error: io_read failed
FAILURE
This patch checks offset value before executing 'lseek', invalid offset
values are filtered.
----------------------------------------
Signed-off-by: Zhihao Cheng <chengzhihao1@huawei.com>
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'tests/fs-tests/stress/atoms/stress_1.c')
0 files changed, 0 insertions, 0 deletions