[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240216225126.454999-1-shresthprasad7@gmail.com>
Date: Sat, 17 Feb 2024 04:21:26 +0530
From: Shresth Prasad <shresthprasad7@...il.com>
To: jpoimboe@...nel.org,
jikos@...nel.org,
mbenes@...e.cz,
pmladek@...e.com,
joe.lawrence@...hat.com,
shuah@...nel.org
Cc: live-patching@...r.kernel.org,
linux-kselftest@...r.kernel.org,
linux-kernel@...r.kernel.org,
linux-kernel-mentees@...ts.linuxfoundation.org,
skhan@...uxfoundation.org,
Shresth Prasad <shresthprasad7@...il.com>
Subject: [PATCH] Fix implicit cast warning in test_klp_state.c
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@...il.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
Powered by blists - more mailing lists