From: sashiko-bot@kernel.org
To: jpoimboe@kernel.org, joe.lawrence@redhat.com, song@kernel.org,
mbenes@suse.cz, jikos@kernel.org, pmladek@suse.com
Cc: "Yafang Shao" <laoar.shao@gmail.com>, live-patching@vger.kernel.org
Subject: Re: [RFC PATCH v4 1/4] livepatch: Make klp_find_func() non static
Date: Tue, 04 Aug 2026 06:56:32 +0000 [thread overview]
Message-ID: <20260804065633.0D6A31F00A3E@smtp.kernel.org> (raw)
In-Reply-To: <20260804065010.44922-2-laoar.shao@gmail.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] klp_find_func() incorrectly returns the search parameter instead of the matched object from the list.
--
--- Patch [1]: [RFC PATCH v4 1/4] livepatch: Make klp_find_func() non static ---
commit 59916304ff12f7685cb556f7a7c1f4a1c5a25b00
Author: Yafang Shao <laoar.shao@gmail.com>
livepatch: Make klp_find_func() non static
This commit makes klp_find_func() non static so it can be used in other
source files by an upcoming patch. It also renames the old_func parameter
to func to better reflect its generic purpose.
> diff --git a/kernel/livepatch/core.c b/kernel/livepatch/core.c
> index 28d15ba58a26d..e07c41a0f3ac8 100644
> --- a/kernel/livepatch/core.c
> +++ b/kernel/livepatch/core.c
[ ... ]
> -static struct klp_func *klp_find_func(struct klp_object *obj,
> - struct klp_func *old_func)
> +/* Check if @func is present in @obj. */
> +struct klp_func *klp_find_func(struct klp_object *obj, struct klp_func *func)
> {
> - struct klp_func *func;
> + struct klp_func *obj_func;
>
> - klp_for_each_func(obj, func) {
> + klp_for_each_func(obj, obj_func) {
> /*
> * Besides identical old_sympos, also consider old_sympos
> * of 0 and 1 are identical.
> */
> - if ((strcmp(old_func->old_name, func->old_name) == 0) &&
> - ((old_func->old_sympos == func->old_sympos) ||
> - (old_func->old_sympos == 0 && func->old_sympos == 1) ||
> - (old_func->old_sympos == 1 && func->old_sympos == 0))) {
> + if ((strcmp(obj_func->old_name, func->old_name) == 0) &&
> + ((obj_func->old_sympos == func->old_sympos) ||
> + (obj_func->old_sympos == 0 && func->old_sympos == 1) ||
> + (obj_func->old_sympos == 1 && func->old_sympos == 0))) {
> return func;
[Severity: Medium]
Will this return the correct object? It looks like this now returns the
search parameter (func) instead of the newly introduced list iterator
variable (obj_func).
If a caller relies on the returned pointer to access the matched object
from the list, they will receive the search parameter instead. This could
lead to incorrect state manipulation or memory corruption for new users
of this exported function.
Should this return obj_func instead?
> }
> }
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260804065010.44922-1-laoar.shao@gmail.com?part=1
next prev parent reply other threads:[~2026-08-04 6:56 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-04 6:50 [RFC PATCH v4 0/4] livepatch: Introduce replace set support Yafang Shao
2026-08-04 6:50 ` [RFC PATCH v4 1/4] livepatch: Make klp_find_func() non static Yafang Shao
2026-08-04 6:56 ` sashiko-bot [this message]
2026-08-04 8:04 ` Yafang Shao
2026-08-04 6:50 ` [RFC PATCH v4 2/4] livepatch: Call klp_init_patch_early() earlier Yafang Shao
2026-08-04 7:03 ` sashiko-bot
2026-08-04 8:00 ` Yafang Shao
2026-08-04 6:50 ` [RFC PATCH v4 3/4] livepatch: Implement replace set for scoped atomic replace Yafang Shao
2026-08-04 7:03 ` sashiko-bot
2026-08-04 7:15 ` Yafang Shao
2026-08-04 23:05 ` Song Liu
2026-08-05 2:54 ` Yafang Shao
2026-08-04 6:50 ` [RFC PATCH v4 4/4] livepatch: Deprecate stack_order Yafang Shao
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=20260804065633.0D6A31F00A3E@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=jikos@kernel.org \
--cc=joe.lawrence@redhat.com \
--cc=jpoimboe@kernel.org \
--cc=laoar.shao@gmail.com \
--cc=live-patching@vger.kernel.org \
--cc=mbenes@suse.cz \
--cc=pmladek@suse.com \
--cc=sashiko-reviews@lists.linux.dev \
--cc=song@kernel.org \
/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