Skip to content

Commit b24ce8f

Browse files
committed
syscalls/fallocate02: Fix failure on 32bit hardware
On 32 bit hardware where off_t is 4 bytes long the LLONG_MAX value overflows to negative numbers and fallocate() returns EINVAL instead of EFBIG. The kernel do_allocate() syscall code uses loff_t for both offset and len so there is no way to overflow it with 32 bit numbers. So we enable these two cases only on 64 bit hardware or if _FILE_OFFSET_BITS is set to 64. Signed-off-by: Cyril Hrubis <[email protected]>
1 parent 3c94161 commit b24ce8f

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

testcases/kernel/syscalls/fallocate/fallocate02.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,10 @@ static struct test_data_t {
7575
{&fdw, FNAMEW, DEFAULT_TEST_MODE, BLOCKS_WRITTEN, 0, EINVAL},
7676
{&fdw, FNAMEW, DEFAULT_TEST_MODE, BLOCKS_WRITTEN, -1, EINVAL},
7777
{&fdw, FNAMEW, DEFAULT_TEST_MODE, -(BLOCKS_WRITTEN+OFFSET), 1, EINVAL},
78+
#if __WORDSIZE == 64 || _FILE_OFFSET_BITS == 64
7879
{&fdw, FNAMEW, DEFAULT_TEST_MODE, MAX_FILESIZE, 1, EFBIG},
7980
{&fdw, FNAMEW, DEFAULT_TEST_MODE, 1, MAX_FILESIZE, EFBIG},
81+
#endif
8082
};
8183

8284
TCID_DEFINE(fallocate02);

0 commit comments

Comments
 (0)