Re: [PATCH] Fix implicit cast warning in test_klp_state.c

From: Shresth Prasad
Date: Wed Feb 21 2024 - 05:04:34 EST


I checked the source code and yes I am on the latest Linux next repo.

Here's the warning:
/home/shresthp/dev/linux_work/linux_next/tools/testing/selftests/livepatch/test_modules/test_klp_state.c:38:24: warning: assignment to ‘struct klp_state *’ from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
   38 |         loglevel_state = klp_get_state(&patch, CONSOLE_LOGLEVEL_STATE);
      |                        ^
/home/shresthp/dev/linux_work/linux_next/tools/testing/selftests/livepatch/test_modules/test_klp_state.c: In function ‘fix_console_loglevel’:
/home/shresthp/dev/linux_work/linux_next/tools/testing/selftests/livepatch/test_modules/test_klp_state.c:55:24: warning: assignment to ‘struct klp_state *’ from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
   55 |         loglevel_state = klp_get_state(&patch, CONSOLE_LOGLEVEL_STATE);
      |                        ^
/home/shresthp/dev/linux_work/linux_next/tools/testing/selftests/livepatch/test_modules/test_klp_state.c: In function ‘restore_console_loglevel’:
/home/shresthp/dev/linux_work/linux_next/tools/testing/selftests/livepatch/test_modules/test_klp_state.c:68:24: warning: assignment to ‘struct klp_state *’ from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
   68 |         loglevel_state = klp_get_state(&patch, CONSOLE_LOGLEVEL_STATE);
      |                        ^
/home/shresthp/dev/linux_work/linux_next/tools/testing/selftests/livepatch/test_modules/test_klp_state.c: In function ‘free_loglevel_state’:
/home/shresthp/dev/linux_work/linux_next/tools/testing/selftests/livepatch/test_modules/test_klp_state.c:80:24: warning: assignment to ‘struct klp_state *’ from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
   80 |         loglevel_state = klp_get_state(&patch, CONSOLE_LOGLEVEL_STATE);
      |                        ^

Thank you for your help so far.

Regards,
Shresth