Skip to content

Commit

Permalink
Merge tag 'linux_kselftest_active-fixes-6.6-rc7' of git://git.kernel.…
Browse files Browse the repository at this point in the history
…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
  • Loading branch information
Linus Torvalds committed Oct 20, 2023
2 parents f74e3ea + cf5a103 commit 444ccf1
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions tools/testing/selftests/user_events/abi_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ static int change_event(bool enable)
return ret;
}

static int reg_enable(long *enable, int size, int bit)
static int reg_enable(void *enable, int size, int bit)
{
struct user_reg reg = {0};
int fd = open(data_file, O_RDWR);
Expand All @@ -69,7 +69,7 @@ static int reg_enable(long *enable, int size, int bit)
return ret;
}

static int reg_disable(long *enable, int bit)
static int reg_disable(void *enable, int bit)
{
struct user_unreg reg = {0};
int fd = open(data_file, O_RDWR);
Expand All @@ -90,7 +90,8 @@ static int reg_disable(long *enable, int bit)
}

FIXTURE(user) {
long check;
int check;
long check_long;
bool umount;
};

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

change_event(false);
self->check = 0;
self->check_long = 0;
}

FIXTURE_TEARDOWN(user) {
Expand Down Expand Up @@ -136,9 +138,9 @@ TEST_F(user, bit_sizes) {

#if BITS_PER_LONG == 8
/* Allow 0-64 bits for 64-bit */
ASSERT_EQ(0, reg_enable(&self->check, sizeof(long), 63));
ASSERT_NE(0, reg_enable(&self->check, sizeof(long), 64));
ASSERT_EQ(0, reg_disable(&self->check, 63));
ASSERT_EQ(0, reg_enable(&self->check_long, sizeof(long), 63));
ASSERT_NE(0, reg_enable(&self->check_long, sizeof(long), 64));
ASSERT_EQ(0, reg_disable(&self->check_long, 63));
#endif

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

if (*(long *)check)
if (*(int *)check)
return 0;
}

Expand Down

0 comments on commit 444ccf1

Please sign in to comment.