[bug report] selftests: ALSA: Cover userspace-driven timers with test

2025-01-17 Thread Dan Carpenter
136 ASSERT_EQ(total_ticks, TICKS_COUNT); 137 pclose(rfp); 138 } regards, dan carpenter

Re: [PATCH] selftests/bpf: Fix incorrect parameters in NULL pointer checking

2024-08-21 Thread Dan Carpenter
On Wed, Aug 21, 2024 at 03:07:27PM -0700, Alexei Starovoitov wrote: > On Wed, Aug 21, 2024 at 2:50 PM Dan Carpenter > wrote: > > > > On Wed, Aug 21, 2024 at 02:03:17PM -0700, Yonghong Song wrote: > > > > > > On 8/19/24 7:34 PM, Hao Ge wrote: > > > &g

Re: [PATCH] selftests/bpf: Fix incorrect parameters in NULL pointer checking

2024-08-21 Thread Dan Carpenter
t_xlated_program()") fixed an issue in the test_verifier.c > > once,but it was reverted this time. > > > > Let's solve this issue with the minimal changes possible. > > > > Reported-by: Dan Carpenter > > Closes: > > https://lore.kernel.org/all/1eb3732f-6

Re: [bug report] selftest: bpf: Test bpf_sk_assign_tcp_reqsk().

2024-08-19 Thread Dan Carpenter
; > > and the following (mssind > ARRAY_SIZE()) is just to make verifier happy. In this case, I was testing code that Smatch couldn't parse completely. But also I have a different check for "> ARRAY_SIZE()" which deliberately ignores the value of mssind since I was missing "false positive" bugs like this. regards, dan carpenter

[bug report] selftests/bpf: Factor out get_xlated_program() helper

2024-08-19 Thread Dan Carpenter
^^^ This should be *buf. 456 perror("can't allocate xlated program buffer"); 457 return -ENOMEM; regards, dan carpenter

[bug report] selftests/bpf: Add C tests for reference tracking

2024-08-19 Thread Dan Carpenter
bpf_printk("sk=%d\n", sk ? 1 : 0); 76 if (sk) 77 bpf_sk_release(sk); 78 return sk ? TC_ACT_OK : TC_ACT_UNSPEC; 79 } regards, dan carpenter

Re: [bug report] selftest: bpf: Test bpf_sk_assign_tcp_reqsk().

2024-08-19 Thread Dan Carpenter
On Mon, Aug 19, 2024 at 09:54:00PM +0300, Dan Carpenter wrote: > Hello Kuniyuki Iwashima, > > Commit a74712241b46 ("selftest: bpf: Test > bpf_sk_assign_tcp_reqsk().") from Jan 15, 2024 (linux-next), leads to > the following Smatch static checker warning: > >

[bug report] selftest: bpf: Test bpf_sk_assign_tcp_reqsk().

2024-08-19 Thread Dan Carpenter
IE_WSCALE_MASK; 504 ctx->attrs.sack_ok = cookie & BPF_SYNCOOKIE_SACK; 505 ctx->attrs.ecn_ok = cookie & BPF_SYNCOOKIE_ECN; 506 507 return 0; 508 err: 509 return -1; 510 } regards, dan carpenter

Re: [bug report] selftests/bpf: BPF register range bounds tester

2024-08-09 Thread Dan Carpenter
On Fri, Aug 09, 2024 at 10:19:54AM -0700, Andrii Nakryiko wrote: > On Fri, Aug 9, 2024 at 4:23 AM Dan Carpenter wrote: > > > > Hello Andrii Nakryiko, > > > > This is a semi-automatic email about new static checker warnings. > > > > Commit 8863238993e2 (&q

Re: [PATCH] selftests/mm: compaction_test: Fix off by one in check_compaction()

2024-08-09 Thread Dan Carpenter
On Fri, Aug 09, 2024 at 11:20:48AM -0600, Shuah Khan wrote: > On 8/9/24 06:32, Dan Carpenter wrote: > > The "initial_nr_hugepages" variable is unsigned long so it takes up to > > 20 characters to print, plus 1 more character for the NUL terminator. > > Unfortunately,

[PATCH] selftests/mm: compaction_test: Fix off by one in check_compaction()

2024-08-09 Thread Dan Carpenter
9293b6b015 ("selftests/mm: compaction_test: fix bogus test success and reduce probability of OOM-killer invocation") Signed-off-by: Dan Carpenter --- tools/testing/selftests/mm/compaction_test.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tools/

[bug report] selftests/bpf: add trusted global subprog arg tests

2024-08-09 Thread Dan Carpenter
ask_nonnull(nullable); This is dereferenced 87 88 if (nullable) NULL check is too late 89 bpf_task_release(nullable); 90 regards, dan carpenter

[bug report] selftests/bpf: BPF register range bounds tester

2024-08-09 Thread Dan Carpenter
1 if (p) Was this NULL check supposed to be checking for the NUL terminator? 1122 p++; 1123 } regards, dan carpenter

Re: [PATCH][next] selftests: kvm: fix shift of 32 bit unsigned int more than 32 bits

2024-05-23 Thread Dan Carpenter
ot;unknown feature"); > - else if (KNOWN_FEATURES & (1u << i)) > + else if (KNOWN_FEATURES & BIT_ULL(u)) ^ Should be i. How does this build? :P regards, dan carpenter

Re: [PATCH] KVM: selftests: Add 'malloc' failure check in test_vmx_nested_state

2024-04-23 Thread Dan Carpenter
gt; > > __ret; > > > }) > > > > Sounds good to me, but I'd call them test_malloc, test_calloc, etc. and > > put them in include/test_util.h > > Possibly terrible idea: what if we used kmalloc() and kcalloc()? K is for > KVM :-) That's a legit terrible idea... It probably would trigger more static checker warnings because the general policy is kmalloc() is kernel code and we *have* to test for errors. To be honest, I would have just rejected the first patch. You obviously know this and have said this earlier in the thread but just for the other people, this is a userspace test that runs for a short time and then exits. If it gets killed because we don't have enough memory that's fine. It would be better to just fix the static checker to not print pointless warnings or educate people to ignore warnings like this. Creating the test_malloc() to silence the warning also seems like an okay idea as well. regards, dan carpenter

Re: [PATCH 00/14] Add support for suppressing warning backtraces

2024-03-13 Thread Dan Carpenter
Thanks! Acked-by: Dan Carpenter regards, dan carpenter

Re: [PATCH bpf-next 2/5] bpf: tracing: support to attach program to multi hooks

2024-02-20 Thread Dan Carpenter
-...@intel.com/config) compiler: m68k-linux-gcc (GCC) 13.2.0 If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot | Reported-by: Dan Carpenter | Closes: https://lore.kernel.org/r

Re: [PATCH] kunit: Fix a NULL vs IS_ERR() bug

2024-01-11 Thread Dan Carpenter
On Fri, Jan 12, 2024 at 07:39:14AM +0800, David Gow wrote: > On Thu, 11 Jan 2024 at 02:55, Dan Carpenter wrote: > > > > The kunit_device_register() function doesn't return NULL, it returns > > error pointers. Change the KUNIT_ASSERT_NOT_NULL() to check for > &

[PATCH] kunit: Fix a NULL vs IS_ERR() bug

2024-01-10 Thread Dan Carpenter
The kunit_device_register() function doesn't return NULL, it returns error pointers. Change the KUNIT_ASSERT_NOT_NULL() to check for ERR_OR_NULL(). Fixes: d03c720e03bd ("kunit: Add APIs for managing devices") Signed-off-by: Dan Carpenter --- It's a pit

[PATCH] kunit: device: Fix a NULL vs IS_ERR() check in init()

2024-01-10 Thread Dan Carpenter
The root_device_register() function does not return NULL, it returns error pointers. Fix the check to match. Fixes: d03c720e03bd ("kunit: Add APIs for managing devices") Signed-off-by: Dan Carpenter --- lib/kunit/device.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) di

Re: [RFC PATCH v3 0/3] Add test to verify probe of devices from discoverable busses

2024-01-01 Thread Dan Carpenter
Life hack: Don't put RFC in the subject. Especially if it's a v2 or higher. No one reads RFC patches. This patchset seems like a low risk patch to apply. regards, dan carpenter

Re: [PATCH v2 RESEND] kunit: debugfs: Handle errors from alloc_string_stream()

2023-11-30 Thread Dan Carpenter
wrong thing. There are between 2-5 places which do this in the kernel. 2) If it's a API that used to return NULL and it's changed to returning error pointers. I've never seen anyone do this, but I've proposed it as a solution to make backporting easier. regards, dan carpenter

Re: [RFC PATCH 0/2] Add a test to verify device probing on ACPI platforms

2023-11-23 Thread Dan Carpenter
here other kinds of devices which can be probed? I feel like you're not valuing your stuff at the right level. This shouldn't be in debugfs. It should be a first class citizen in sysfs. The exact format for this information is slightly tricky and people will probably debate that. But I think most people will agree that it's super useful. regards, dan carpenter

Re: [RFC PATCH 0/2] Add a test to verify device probing on ACPI platforms

2023-11-22 Thread Dan Carpenter
Your talk was interesting at Linux Plumbers. https://www.youtube.com/watch?v=oE73eVSyFXQ [time +2:35] This is probably a stupid question, but why not just add something to call_driver_probe() which creates a sysfs directory tree with all the driver information? regards, dan carpenter

Re: [PATCH v1] selftests/media_tests: fix a resource leak

2023-11-21 Thread Dan Carpenter
On Tue, Nov 21, 2023 at 01:32:38AM -0800, Zhu Jun wrote: > From: zhujun2 > > The opened file should be closed in main(), otherwise resource > leak will occur that this problem was discovered by code reading > > Signed-off-by: zhujun2 > --- > > Hi Dan Carpenter >

Re: [PATCH] selftests/media_tests: fix a resource leak

2023-11-20 Thread Dan Carpenter
in short running programs. It's different for an operating system or a web server which is expected to have a long uptime. But these programs are going to run quickly and then exit so resource leaks are not an issue. regards, dan carpenter

Re: [RFC] drm/tests: annotate intentional stack trace in drm_test_rect_calc_hscale()

2023-11-15 Thread Dan Carpenter
now I know to look for WARN(), lockdep, and KASAN. What other bugs formats do we have? Probably someone like the syzbot devs have already has written a script like this? regards, dan carpenter

Re: [RFC] drm/tests: annotate intentional stack trace in drm_test_rect_calc_hscale()

2023-11-01 Thread Dan Carpenter
Let me add Richard to the CC list. See lore for more details. https://lore.kernel.org/all/CA+G9fYuA643RHHpPnz9Ww7rr3zV5a0y=7_uFcybBSL=qp_s...@mail.gmail.com/ On Tue, Oct 31, 2023 at 09:57:48PM +0530, Naresh Kamboju wrote: > On Mon, 30 Oct 2023 at 14:33, Dan Carpenter wrote: > > &g

[RFC] drm/tests: annotate intentional stack trace in drm_test_rect_calc_hscale()

2023-10-30 Thread Dan Carpenter
onal warning finished\n" message at the end. I haven't actually tested this patch... Daniel, do you have a list of intentional stack traces we could annotate? Signed-off-by: Dan Carpenter --- drivers/gpu/drm/tests/drm_rect_test.c | 2 ++ include/kunit/test.h | 3 +++

[bug report] kunit: test: Fix the possible memory leak in executor_test

2023-10-05 Thread Dan Carpenter
kunit_add_action(test, free_suite_set, (void *)free); 279 } regards, dan carpenter

Re: [PATCH] kunit: debugfs: Handle errors from alloc_string_stream()

2023-09-27 Thread Dan Carpenter
bugfs_create_suite() error: 'test_case->log' > dereferencing possible ERR_PTR() > > Signed-off-by: Richard Fitzgerald > Reported-by: Dan Carpenter > Fixes: 05e2006ce493 ("kunit: Use string_stream for test log") > --- > lib/kunit/debugfs.c | 29 ++

Re: [PATCH] kunit: Check for kunit_parse_glob_filter() failure

2023-09-26 Thread Dan Carpenter
On Tue, Sep 19, 2023 at 02:49:43PM -0400, Rae Moar wrote: > On Fri, Sep 15, 2023 at 8:58 AM Dan Carpenter > wrote: > > > > Smatch complains that the missing error checks would lead to a crash: > > > > lib/kunit/executor_test.c:40 parse_filter_test()

[PATCH] kunit: Check for kunit_parse_glob_filter() failure

2023-09-15 Thread Dan Carpenter
Smatch complains that the missing error checks would lead to a crash: lib/kunit/executor_test.c:40 parse_filter_test() error: double free of 'filter.test_glob' We may as well do it right... Fixes: a127b154a8f2 ("kunit: tool: allow filtering test cases via glob"