public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH V2] selftests: lsm: Refactor `flags_overset_lsm_set_self_attr` test
@ 2024-11-16 15:21 Amit Vadhavana
  2024-12-18 23:14 ` [PATCH v2] " Paul Moore
  0 siblings, 1 reply; 2+ messages in thread
From: Amit Vadhavana @ 2024-11-16 15:21 UTC (permalink / raw)
  To: paul, jmorris, serge, casey, shuah
  Cc: ricardo, av2082000, skhan, linux-kernel-mentees,
	linux-security-module, linux-kselftest, linux-kernel

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>
---
V1:- https://lore.kernel.org/all/20241112182810.24761-1-av2082000@gmail.com/
V1 -> V2 :
write complete sentences instead of bullet points in the change log.
---
 tools/testing/selftests/lsm/lsm_set_self_attr_test.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/tools/testing/selftests/lsm/lsm_set_self_attr_test.c b/tools/testing/selftests/lsm/lsm_set_self_attr_test.c
index 66dec47e3ca3..732e89fe99c0 100644
--- a/tools/testing/selftests/lsm/lsm_set_self_attr_test.c
+++ b/tools/testing/selftests/lsm/lsm_set_self_attr_test.c
@@ -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);
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v2] selftests: lsm: Refactor  `flags_overset_lsm_set_self_attr` test
  2024-11-16 15:21 [PATCH V2] selftests: lsm: Refactor `flags_overset_lsm_set_self_attr` test Amit Vadhavana
@ 2024-12-18 23:14 ` Paul Moore
  0 siblings, 0 replies; 2+ messages in thread
From: Paul Moore @ 2024-12-18 23:14 UTC (permalink / raw)
  To: Amit Vadhavana, jmorris, serge, casey, shuah
  Cc: ricardo, av2082000, skhan, linux-kernel-mentees,
	linux-security-module, linux-kselftest, linux-kernel

On Nov 16, 2024 Amit Vadhavana <av2082000@gmail.com> wrote:
> 
> 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>
> ---
> V1:- https://lore.kernel.org/all/20241112182810.24761-1-av2082000@gmail.com/
> V1 -> V2 :
> write complete sentences instead of bullet points in the change log.
> ---
>  tools/testing/selftests/lsm/lsm_set_self_attr_test.c | 7 +++----
>  1 file changed, 3 insertions(+), 4 deletions(-)

Thank you for working on improving the tests, merged into lsm/dev.

--
paul-moore.com

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-12-18 23:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-16 15:21 [PATCH V2] selftests: lsm: Refactor `flags_overset_lsm_set_self_attr` test Amit Vadhavana
2024-12-18 23:14 ` [PATCH v2] " Paul Moore

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox