Skip to content

Commit 444ccf1

Browse files
committed
Merge tag 'linux_kselftest_active-fixes-6.6-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest
Pull Kselftest fix from Shuah Khan: "One single fix to assert check in user_events abi_test to properly check bit value on Big Endian architectures. The code treated the bit values as Little Endian and the check failed on Big Endian" * tag 'linux_kselftest_active-fixes-6.6-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest: selftests/user_events: Fix abi_test for BE archs
2 parents f74e3ea + cf5a103 commit 444ccf1

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

tools/testing/selftests/user_events/abi_test.c

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ static int change_event(bool enable)
4747
return ret;
4848
}
4949

50-
static int reg_enable(long *enable, int size, int bit)
50+
static int reg_enable(void *enable, int size, int bit)
5151
{
5252
struct user_reg reg = {0};
5353
int fd = open(data_file, O_RDWR);
@@ -69,7 +69,7 @@ static int reg_enable(long *enable, int size, int bit)
6969
return ret;
7070
}
7171

72-
static int reg_disable(long *enable, int bit)
72+
static int reg_disable(void *enable, int bit)
7373
{
7474
struct user_unreg reg = {0};
7575
int fd = open(data_file, O_RDWR);
@@ -90,7 +90,8 @@ static int reg_disable(long *enable, int bit)
9090
}
9191

9292
FIXTURE(user) {
93-
long check;
93+
int check;
94+
long check_long;
9495
bool umount;
9596
};
9697

@@ -99,6 +100,7 @@ FIXTURE_SETUP(user) {
99100

100101
change_event(false);
101102
self->check = 0;
103+
self->check_long = 0;
102104
}
103105

104106
FIXTURE_TEARDOWN(user) {
@@ -136,9 +138,9 @@ TEST_F(user, bit_sizes) {
136138

137139
#if BITS_PER_LONG == 8
138140
/* Allow 0-64 bits for 64-bit */
139-
ASSERT_EQ(0, reg_enable(&self->check, sizeof(long), 63));
140-
ASSERT_NE(0, reg_enable(&self->check, sizeof(long), 64));
141-
ASSERT_EQ(0, reg_disable(&self->check, 63));
141+
ASSERT_EQ(0, reg_enable(&self->check_long, sizeof(long), 63));
142+
ASSERT_NE(0, reg_enable(&self->check_long, sizeof(long), 64));
143+
ASSERT_EQ(0, reg_disable(&self->check_long, 63));
142144
#endif
143145

144146
/* Disallowed sizes (everything beside 4 and 8) */
@@ -200,7 +202,7 @@ static int clone_check(void *check)
200202
for (i = 0; i < 10; ++i) {
201203
usleep(100000);
202204

203-
if (*(long *)check)
205+
if (*(int *)check)
204206
return 0;
205207
}
206208

0 commit comments

Comments
 (0)