Skip to content

Commit 7a9b65a

Browse files
AmitVadhavana14pcmoore
authored andcommitted
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 <[email protected]> Reviewed-by: Shuah Khan <[email protected]> Signed-off-by: Amit Vadhavana <[email protected]> [PM: subject tweak] Signed-off-by: Paul Moore <[email protected]>
1 parent 0129201 commit 7a9b65a

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

tools/testing/selftests/lsm/lsm_set_self_attr_test.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,16 +56,15 @@ TEST(flags_zero_lsm_set_self_attr)
5656
TEST(flags_overset_lsm_set_self_attr)
5757
{
5858
const long page_size = sysconf(_SC_PAGESIZE);
59-
char *ctx = calloc(page_size, 1);
59+
struct lsm_ctx *ctx = calloc(page_size, 1);
6060
__u32 size = page_size;
61-
struct lsm_ctx *tctx = (struct lsm_ctx *)ctx;
6261

6362
ASSERT_NE(NULL, ctx);
6463
if (attr_lsm_count()) {
65-
ASSERT_LE(1, lsm_get_self_attr(LSM_ATTR_CURRENT, tctx, &size,
64+
ASSERT_LE(1, lsm_get_self_attr(LSM_ATTR_CURRENT, ctx, &size,
6665
0));
6766
}
68-
ASSERT_EQ(-1, lsm_set_self_attr(LSM_ATTR_CURRENT | LSM_ATTR_PREV, tctx,
67+
ASSERT_EQ(-1, lsm_set_self_attr(LSM_ATTR_CURRENT | LSM_ATTR_PREV, ctx,
6968
size, 0));
7069

7170
free(ctx);

0 commit comments

Comments
 (0)