mirror of
https://github.com/torvalds/linux.git
synced 2026-05-29 17:43:52 +02:00
selftests: refactor the lsm flags_overset_lsm_set_self_attr test
Remove the temporary context variable `tctx` to simplify the code. use the original context `ctx` directly in calls to `lsm_get_self_attr`, eliminating redundancy without any functional changes. Reviewed-by: Casey Schaufler <casey@schaufler-ca.com> Reviewed-by: Shuah Khan <skhan@linuxfoundation.org> Signed-off-by: Amit Vadhavana <av2082000@gmail.com> [PM: subject tweak] Signed-off-by: Paul Moore <paul@paul-moore.com>
This commit is contained in:
parent
0129201310
commit
7a9b65ab0a
|
|
@ -56,16 +56,15 @@ TEST(flags_zero_lsm_set_self_attr)
|
|||
TEST(flags_overset_lsm_set_self_attr)
|
||||
{
|
||||
const long page_size = sysconf(_SC_PAGESIZE);
|
||||
char *ctx = calloc(page_size, 1);
|
||||
struct lsm_ctx *ctx = calloc(page_size, 1);
|
||||
__u32 size = page_size;
|
||||
struct lsm_ctx *tctx = (struct lsm_ctx *)ctx;
|
||||
|
||||
ASSERT_NE(NULL, ctx);
|
||||
if (attr_lsm_count()) {
|
||||
ASSERT_LE(1, lsm_get_self_attr(LSM_ATTR_CURRENT, tctx, &size,
|
||||
ASSERT_LE(1, lsm_get_self_attr(LSM_ATTR_CURRENT, ctx, &size,
|
||||
0));
|
||||
}
|
||||
ASSERT_EQ(-1, lsm_set_self_attr(LSM_ATTR_CURRENT | LSM_ATTR_PREV, tctx,
|
||||
ASSERT_EQ(-1, lsm_set_self_attr(LSM_ATTR_CURRENT | LSM_ATTR_PREV, ctx,
|
||||
size, 0));
|
||||
|
||||
free(ctx);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user