From: Joe Lawrence <joe.lawrence@redhat.com>
To: Nicolai Stange <nstange@suse.de>,
Shresth Prasad <shresthprasad7@gmail.com>
Cc: zhangwarden@gmail.com, jikos@kernel.org, jpoimboe@kernel.org,
linux-kernel-mentees@lists.linuxfoundation.org,
linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org,
live-patching@vger.kernel.org, mbenes@suse.cz,
mpdesouza@suse.com, pmladek@suse.com, shuah@kernel.org,
skhan@linuxfoundation.org
Subject: Re: [PATCH] Fix implicit cast warning in test_klp_state.c
Date: Wed, 21 Feb 2024 13:26:57 -0500 [thread overview]
Message-ID: <88672d5a-1b12-a6f2-bf7b-8670eeddc711@redhat.com> (raw)
In-Reply-To: <22981.124022107441100115@us-mta-655.us.mimecast.lan>
On 2/21/24 07:44, Nicolai Stange wrote:
> Shresth Prasad <shresthprasad7@gmail.com> writes:
>
>> 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);
>> | ^
>
>
> Is the declaration of klp_get_state() visible at that point, i.e. is
> there perhaps any warning about missing declarations above that?
>
> Otherwise C rules would default to assume an 'int' return type.
>
This is an interesting clue. I thought I might be able to reproduce the
build error by modifying include/livepatch.h and running `make -j15 -C
tools/testing/selftests/livepatch` ... but that seemed to work fine on
my system. I even removed the entire include/ subdir from my tree and
it still built the test module. Huh?
Then I moved /lib/modules/$(uname -r)/build out of the way and saw that
the compilation failed. Ah hah -- that's right, it's using the system
build tree. That version of livepatch.h may have a missing or
completely different definition of klp_get_state().
How does this sequence work for you, Shresth:
# Verify that kernel livepatching is turned on
$ grep LIVEPATCH .config
CONFIG_HAVE_LIVEPATCH=y
CONFIG_LIVEPATCH=y
# Build linux-next kernel tree and then the livepatch selftests,
# pointing KDIR to this tree
$ make -j$(nproc) vmlinux && \
make -j$(nproc) KDIR=$(pwd) -C tools/testing/selftests/livepatch
--
Joe
next prev parent reply other threads:[~2024-02-21 18:27 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
2024-02-22 8:35 ` Shresth Prasad
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=88672d5a-1b12-a6f2-bf7b-8670eeddc711@redhat.com \
--to=joe.lawrence@redhat.com \
--cc=jikos@kernel.org \
--cc=jpoimboe@kernel.org \
--cc=linux-kernel-mentees@lists.linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=live-patching@vger.kernel.org \
--cc=mbenes@suse.cz \
--cc=mpdesouza@suse.com \
--cc=nstange@suse.de \
--cc=pmladek@suse.com \
--cc=shresthprasad7@gmail.com \
--cc=shuah@kernel.org \
--cc=skhan@linuxfoundation.org \
--cc=zhangwarden@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).