* [PATCH] kunit: Fix wrong parameter to kunit_deactivate_static_stub()
@ 2025-05-20 8:20 Tzung-Bi Shih
2025-05-21 7:44 ` David Gow
0 siblings, 1 reply; 3+ messages in thread
From: Tzung-Bi Shih @ 2025-05-20 8:20 UTC (permalink / raw)
To: brendan.higgins, davidgow; +Cc: rmoar, linux-kselftest, kunit-dev, tzungbi
kunit_deactivate_static_stub() accepts real_fn_addr instead of
replacement_addr. In the case, it always passes NULL to
kunit_deactivate_static_stub().
Fix it.
Fixes: e047c5eaa763 ("kunit: Expose 'static stub' API to redirect functions")
Signed-off-by: Tzung-Bi Shih <tzungbi@kernel.org>
---
lib/kunit/static_stub.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/kunit/static_stub.c b/lib/kunit/static_stub.c
index 92b2cccd5e76..484fd85251b4 100644
--- a/lib/kunit/static_stub.c
+++ b/lib/kunit/static_stub.c
@@ -96,7 +96,7 @@ void __kunit_activate_static_stub(struct kunit *test,
/* If the replacement address is NULL, deactivate the stub. */
if (!replacement_addr) {
- kunit_deactivate_static_stub(test, replacement_addr);
+ kunit_deactivate_static_stub(test, real_fn_addr);
return;
}
--
2.49.0.1101.gccaa498523-goog
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] kunit: Fix wrong parameter to kunit_deactivate_static_stub()
2025-05-20 8:20 [PATCH] kunit: Fix wrong parameter to kunit_deactivate_static_stub() Tzung-Bi Shih
@ 2025-05-21 7:44 ` David Gow
2025-05-22 5:54 ` Tzung-Bi Shih
0 siblings, 1 reply; 3+ messages in thread
From: David Gow @ 2025-05-21 7:44 UTC (permalink / raw)
To: Tzung-Bi Shih; +Cc: brendan.higgins, rmoar, linux-kselftest, kunit-dev
[-- Attachment #1: Type: text/plain, Size: 1235 bytes --]
On Tue, 20 May 2025 at 16:21, Tzung-Bi Shih <tzungbi@kernel.org> wrote:
>
> kunit_deactivate_static_stub() accepts real_fn_addr instead of
> replacement_addr. In the case, it always passes NULL to
> kunit_deactivate_static_stub().
>
> Fix it.
>
> Fixes: e047c5eaa763 ("kunit: Expose 'static stub' API to redirect functions")
> Signed-off-by: Tzung-Bi Shih <tzungbi@kernel.org>
> ---
Nice catch! I guess no-one's ever tried to pass NULL to deactivate the stub!
(Maybe we should add a test for this somewhere?)
Reviewed-by: David Gow <davidgow@google.com>
Cheers,
-- David
> lib/kunit/static_stub.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/lib/kunit/static_stub.c b/lib/kunit/static_stub.c
> index 92b2cccd5e76..484fd85251b4 100644
> --- a/lib/kunit/static_stub.c
> +++ b/lib/kunit/static_stub.c
> @@ -96,7 +96,7 @@ void __kunit_activate_static_stub(struct kunit *test,
>
> /* If the replacement address is NULL, deactivate the stub. */
> if (!replacement_addr) {
> - kunit_deactivate_static_stub(test, replacement_addr);
> + kunit_deactivate_static_stub(test, real_fn_addr);
> return;
> }
>
> --
> 2.49.0.1101.gccaa498523-goog
>
[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 5281 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] kunit: Fix wrong parameter to kunit_deactivate_static_stub()
2025-05-21 7:44 ` David Gow
@ 2025-05-22 5:54 ` Tzung-Bi Shih
0 siblings, 0 replies; 3+ messages in thread
From: Tzung-Bi Shih @ 2025-05-22 5:54 UTC (permalink / raw)
To: David Gow; +Cc: brendan.higgins, rmoar, linux-kselftest, kunit-dev
On Wed, May 21, 2025 at 03:44:04PM +0800, David Gow wrote:
> On Tue, 20 May 2025 at 16:21, Tzung-Bi Shih <tzungbi@kernel.org> wrote:
> >
> > kunit_deactivate_static_stub() accepts real_fn_addr instead of
> > replacement_addr. In the case, it always passes NULL to
> > kunit_deactivate_static_stub().
> >
> > Fix it.
> >
> > Fixes: e047c5eaa763 ("kunit: Expose 'static stub' API to redirect functions")
> > Signed-off-by: Tzung-Bi Shih <tzungbi@kernel.org>
> > ---
>
> Nice catch! I guess no-one's ever tried to pass NULL to deactivate the stub!
>
> (Maybe we should add a test for this somewhere?)
Added a test for this,
https://lore.kernel.org/linux-kselftest/20250522054912.2948008-1-tzungbi@kernel.org/T/#u
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-05-22 5:54 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-20 8:20 [PATCH] kunit: Fix wrong parameter to kunit_deactivate_static_stub() Tzung-Bi Shih
2025-05-21 7:44 ` David Gow
2025-05-22 5:54 ` Tzung-Bi Shih
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).