Skip to content

Commit 1155180

Browse files
Ram Paitorvalds
authored andcommitted
selftests/vm/pkeys: fix pkey_disable_clear()
Currently, pkey_disable_clear() sets the specified bits instead clearing them. This has been dead code up to now because its only callers i.e. pkey_access/write_allow() are also unused. Signed-off-by: Ram Pai <[email protected]> Signed-off-by: Sandipan Das <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Acked-by: Dave Hansen <[email protected]> Cc: Dave Hansen <[email protected]> Cc: Florian Weimer <[email protected]> Cc: "Desnes A. Nunes do Rosario" <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Thiago Jung Bauermann <[email protected]> Cc: "Aneesh Kumar K.V" <[email protected]> Cc: Michael Ellerman <[email protected]> Cc: Michal Hocko <[email protected]> Cc: Michal Suchanek <[email protected]> Cc: Shuah Khan <[email protected]> Link: http://lkml.kernel.org/r/1f70bca60330a85dca42c3cd98212bb1cdf5a076.1585646528.git.sandipan@linux.ibm.com Signed-off-by: Linus Torvalds <[email protected]>
1 parent 0c416bc commit 1155180

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

tools/testing/selftests/vm/protection_keys.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -418,7 +418,7 @@ void pkey_disable_clear(int pkey, int flags)
418418
pkey, pkey, pkey_rights);
419419
pkey_assert(pkey_rights >= 0);
420420

421-
pkey_rights |= flags;
421+
pkey_rights &= ~flags;
422422

423423
ret = hw_pkey_set(pkey, pkey_rights, 0);
424424
shadow_pkey_reg = set_pkey_bits(shadow_pkey_reg, pkey, pkey_rights);
@@ -431,7 +431,7 @@ void pkey_disable_clear(int pkey, int flags)
431431
dprintf1("%s(%d) pkey_reg: 0x%016llx\n", __func__,
432432
pkey, read_pkey_reg());
433433
if (flags)
434-
assert(read_pkey_reg() > orig_pkey_reg);
434+
assert(read_pkey_reg() < orig_pkey_reg);
435435
}
436436

437437
void pkey_write_allow(int pkey)

0 commit comments

Comments
 (0)