linux-kernel-mentees.lists.linuxfoundation.org archive mirror
 help / color / mirror / Atom feed
* [PATCH]     Fix implicit cast warning in test_klp_state.c
@ 2024-02-16 22:51 Shresth Prasad
  2024-02-19 14:16 ` Marcos Paulo de Souza
  0 siblings, 1 reply; 12+ messages in thread
From: Shresth Prasad @ 2024-02-16 22:51 UTC (permalink / raw)
  To: jpoimboe, jikos, mbenes, pmladek, joe.lawrence, shuah
  Cc: live-patching, linux-kselftest, linux-kernel,
	linux-kernel-mentees, skhan, Shresth Prasad

    The function `klp_get_state` returns an `int` value, but the variable
    `loglevel_state` is of type `struct klp_state *` and thus does an
    implicit cast. Explicitly casting these values fixes:

            - warning: assignment to ‘struct klp_state *’ from ‘int’
	    makes pointer from integer without a cast [-Wint-conversion]

    on lines 38, 55, 68 and 80 of test_klp_state.c

Signed-off-by: Shresth Prasad <shresthprasad7@gmail.com>
---
 .../selftests/livepatch/test_modules/test_klp_state.c     | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/tools/testing/selftests/livepatch/test_modules/test_klp_state.c b/tools/testing/selftests/livepatch/test_modules/test_klp_state.c
index 57a4253acb01..ae6b1ca15fc0 100644
--- a/tools/testing/selftests/livepatch/test_modules/test_klp_state.c
+++ b/tools/testing/selftests/livepatch/test_modules/test_klp_state.c
@@ -35,7 +35,7 @@ static int allocate_loglevel_state(void)
 {
 	struct klp_state *loglevel_state;
 
-	loglevel_state = klp_get_state(&patch, CONSOLE_LOGLEVEL_STATE);
+	loglevel_state = (struct klp_state *)klp_get_state(&patch, CONSOLE_LOGLEVEL_STATE);
 	if (!loglevel_state)
 		return -EINVAL;
 
@@ -52,7 +52,7 @@ static void fix_console_loglevel(void)
 {
 	struct klp_state *loglevel_state;
 
-	loglevel_state = klp_get_state(&patch, CONSOLE_LOGLEVEL_STATE);
+	loglevel_state = (struct klp_state *)klp_get_state(&patch, CONSOLE_LOGLEVEL_STATE);
 	if (!loglevel_state)
 		return;
 
@@ -65,7 +65,7 @@ static void restore_console_loglevel(void)
 {
 	struct klp_state *loglevel_state;
 
-	loglevel_state = klp_get_state(&patch, CONSOLE_LOGLEVEL_STATE);
+	loglevel_state = (struct klp_state *)klp_get_state(&patch, CONSOLE_LOGLEVEL_STATE);
 	if (!loglevel_state)
 		return;
 
@@ -77,7 +77,7 @@ static void free_loglevel_state(void)
 {
 	struct klp_state *loglevel_state;
 
-	loglevel_state = klp_get_state(&patch, CONSOLE_LOGLEVEL_STATE);
+	loglevel_state = (struct klp_state *)klp_get_state(&patch, CONSOLE_LOGLEVEL_STATE);
 	if (!loglevel_state)
 		return;
 
-- 
2.43.1


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

end of thread, other threads:[~2024-02-22  8:35 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-16 22:51 [PATCH] Fix implicit cast warning in test_klp_state.c Shresth Prasad
2024-02-19 14:16 ` Marcos Paulo de Souza
2024-02-20  6:06   ` zhang warden
2024-02-20 11:53     ` Shresth Prasad
2024-02-20 12:00       ` Marcos Paulo de Souza
2024-02-20 13:20         ` Shresth Prasad
2024-02-21  2:38           ` zhang warden
2024-02-21  9:59             ` Shresth Prasad
2024-02-21 12:44               ` Nicolai Stange
2024-02-22  8:12                 ` Shresth Prasad
     [not found]               ` <22981.124022107441100115@us-mta-655.us.mimecast.lan>
2024-02-21 18:26                 ` Joe Lawrence
2024-02-22  8:35                   ` Shresth Prasad

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).