diff options
author | Zhihao Cheng <chengzhihao1@huawei.com> | 2019-06-14 20:14:38 +0800 |
---|---|---|
committer | David Oberhollenzer <david.oberhollenzer@sigma-star.at> | 2019-06-16 12:27:10 +0200 |
commit | c74c62420cbe1939c924e83f00e8838f148ae051 (patch) | |
tree | ca3a6363ad10e20d4bbae02d41da68b098e2eae3 /tests/ubi-tests/io_update.c | |
parent | e5530fea6a3e094e83303749c20622f0af12f21f (diff) |
ubi-tests: ubi_mkvol_request: Fully initialize 'struct ubi_mkvol_request req'
'struct ubi_mkvol_request req' is one parameter of the function 'ubi_mkvol'
, this parameter will be passed to kernel and then be checked. It acts as a
local variable in many ubi tests, such as io_basic, io_read, mkvol_bad,
mkvol_basic, etc.
After commit c355aa465fce ("ubi: expose the volume CRC check skip flag") in
linux-stable, 'struct ubi_mkvol_request' supports a new configuration named
'flags', and req.flags will be checked in kernel function
'verify_mkvol_req'. Currently, there is no initialization for req.flags
before 'ubi_mkvol' invoked. So, req.flags can be an arbitrary number passed
to kernel. When we run ubi tests in qemu (x86_64, kernel image: 5.2.0-rc4),
the following errors may occur:
======================================================================
======================================================================
======================================================================
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
[mkvol_bad] test_mkvol():105: ubi_mkvol failed with error 22
(Invalid argument), expected 28 (No space left on device)
[mkvol_bad] test_mkvol():105: bytes = 16060929
Error: mkvol_bad failed
FAILURE
This patch fully initializes every 'struct ubi_mkvol_request req' passed to
'ubi_mkvol', which can fix the bug that the ubi test failed caused by that
req.flags was not initialized. And it is still compatible with old kernel
before kernel commit c355aa465fce ("ubi: expose the volume CRC check skip
flag").
----------------------------------------
Signed-off-by: Zhihao Cheng <chengzhihao1@huawei.com>
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'tests/ubi-tests/io_update.c')
-rw-r--r-- | tests/ubi-tests/io_update.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/tests/ubi-tests/io_update.c b/tests/ubi-tests/io_update.c index fe3ad7b..f48df1d 100644 --- a/tests/ubi-tests/io_update.c +++ b/tests/ubi-tests/io_update.c @@ -233,6 +233,7 @@ static int test_update(int type) req.vol_id = UBI_VOL_NUM_AUTO; req.vol_type = type; req.name = name; + req.flags = 0; req.alignment = alignments[i]; req.alignment -= req.alignment % dev_info.min_io_size; |