[PATCH] synthetic tracing: Fix trace_string() return value

2024-02-14 Thread Thorsten Blum
Fix trace_string() by assigning the string length to the return variable which got lost in commit ddeea494a16f ("tracing/synthetic: Use union instead of casts") and caused trace_string() to always return 0. Signed-off-by: Thorsten Blum --- kernel/trace/trace_events_synth.c | 3 +

[PATCH] tracing: Use div64_u64() instead of do_div()

2024-02-25 Thread Thorsten Blum
Fixes Coccinelle/coccicheck warnings reported by do_div.cocci. Compared to do_div(), div64_u64() does not implicitly cast the divisor and does not unnecessarily calculate the remainder. Signed-off-by: Thorsten Blum --- kernel/trace/trace_benchmark.c | 5 ++--- 1 file changed, 2 insertions

[PATCH] tracing: Explicitly cast divisor to fix Coccinelle warning

2024-03-18 Thread Thorsten Blum
Explicitly cast the divisor to u32 to fix a Coccinelle/coccicheck warning reported by do_div.cocci. Signed-off-by: Thorsten Blum --- kernel/trace/trace_benchmark.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/trace/trace_benchmark.c b/kernel/trace/trace_benchmark.c

Re: [PATCH] tracing: Explicitly cast divisor to fix Coccinelle warning

2024-03-20 Thread Thorsten Blum
On 20. Mar 2024, at 11:27, Masami Hiramatsu (Google) wrote: > > Hmm, strange, trace_do_benchmark() has another do_div(u64, u64). > >do { >last_seed = seed; >seed = stddev; >if (!last_seed) >

Re: [PATCH] tracing: Explicitly cast divisor to fix Coccinelle warning

2024-03-20 Thread Thorsten Blum
On 20. Mar 2024, at 16:01, Thorsten Blum wrote: > > Coccinelle also finds this one, but please ignore this patch as I just > realized > this was already fixed in another patch of mine from February. > > Sorry for the inconvenience. > > Link: > https://l

[PATCH v2] tracing: Improve performance by using do_div()

2024-03-20 Thread Thorsten Blum
s already used twice in trace_do_benchmark() when calculating the standard deviation: do_div(stddev, (u32)bm_cnt); do_div(stddev, (u32)bm_cnt - 1); Signed-off-by: Thorsten Blum --- Changes in v2: - Update patch with latest changes from master - Update patch title and description --- kernel/

[RESEND PATCH v2] tracing: Improve performance by using do_div()

2024-03-29 Thread Thorsten Blum
s already used twice in trace_do_benchmark() when calculating the standard deviation: do_div(stddev, (u32)bm_cnt); do_div(stddev, (u32)bm_cnt - 1); Signed-off-by: Thorsten Blum --- Changes in v2: - Update patch with latest changes from master - Update patch title and description --- kernel/

[PATCH] ring-buffer: Use vma_pages() helper function

2024-06-15 Thread Thorsten Blum
Use the vma_pages() helper function and fix the following Coccinelle/coccicheck warning reported by vma_pages.cocci: WARNING: Consider using vma_pages helper on vma Rename the local variable vma_pages accordingly. Signed-off-by: Thorsten Blum --- kernel/trace/ring_buffer.c | 8

[RESEND PATCH] ring-buffer: Use vma_pages() helper function

2024-07-09 Thread Thorsten Blum
Use the vma_pages() helper function and fix the following Coccinelle/coccicheck warning reported by vma_pages.cocci: WARNING: Consider using vma_pages helper on vma Rename the local variable vma_pages accordingly. Signed-off-by: Thorsten Blum --- kernel/trace/ring_buffer.c | 8 1

[PATCH] bootconfig: Remove duplicate included header file linux/bootconfig.h

2024-07-10 Thread Thorsten Blum
The header file linux/bootconfig.h is included whether __KERNEL__ is defined or not. Include it only once before the #ifdef/#else/#endif preprocessor directives and remove the following make includecheck warning: linux/bootconfig.h is included more than once Signed-off-by: Thorsten Blum

[PATCH v2] bootconfig: Remove duplicate included header file linux/bootconfig.h

2024-07-11 Thread Thorsten Blum
delete the now empty #else block. Signed-off-by: Thorsten Blum --- Changes in v2: - Move comment and delete #else as suggested by Masami Hiramatsu - Link to v1: https://lore.kernel.org/linux-kernel/20240711002152.800028-2-thorsten.b...@toblux.com/ --- lib/bootconfig.c | 20 +--- 1

[PATCH net-next] ieee802154: Replace BOOL_TO_STR() with str_true_false()

2024-10-20 Thread Thorsten Blum
Replace the custom BOOL_TO_STR() macro with the str_true_false() helper function and remove the macro. Signed-off-by: Thorsten Blum --- net/ieee802154/trace.h | 6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/net/ieee802154/trace.h b/net/ieee802154/trace.h index

Re: [RESEND PATCH] x86/sgx: Use vmalloc_array() instead of vmalloc()

2024-10-28 Thread Thorsten Blum
On 28. Oct 2024, at 23:29, Huang, Kai wrote: > On 27/10/2024 12:32 am, Thorsten Blum wrote: >> Use vmalloc_array() instead of vmalloc() to calculate the number of >> bytes to allocate. > > This says nothing about _why_. Is it because we want to take advantage of > the

Re: [PATCH net-next] ieee802154: Replace BOOL_TO_STR() with str_true_false()

2024-10-28 Thread Thorsten Blum
Hi Stefan, > On 28. Oct 2024, at 16:57, Stefan Schmidt wrote: > > Hello Thorsten Blum. > > On Sun, 20 Oct 2024 13:23:13 +0200, Thorsten Blum wrote: >> Replace the custom BOOL_TO_STR() macro with the str_true_false() helper >> function and remove the macro. >&g

[RESEND PATCH] x86/sgx: Use vmalloc_array() instead of vmalloc()

2024-10-26 Thread Thorsten Blum
Use vmalloc_array() instead of vmalloc() to calculate the number of bytes to allocate. Reviewed-by: Jarkko Sakkinen Signed-off-by: Thorsten Blum --- arch/x86/kernel/cpu/sgx/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/kernel/cpu/sgx/main.c b/arch/x86

[RESEND PATCH] x86/sgx: Use vmalloc_array() instead of vmalloc()

2024-11-12 Thread Thorsten Blum
Use vmalloc_array() instead of vmalloc() to calculate the number of bytes to allocate. Reviewed-by: Jarkko Sakkinen Acked-by: Kai Huang Signed-off-by: Thorsten Blum --- arch/x86/kernel/cpu/sgx/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/kernel/cpu/sgx

[PATCH] x86/sgx: Use vmalloc_array() instead of vmalloc()

2024-09-29 Thread Thorsten Blum
Use vmalloc_array() instead of vmalloc() to calculate the number of bytes to allocate. Signed-off-by: Thorsten Blum --- arch/x86/kernel/cpu/sgx/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/kernel/cpu/sgx/main.c b/arch/x86/kernel/cpu/sgx/main.c index

[PATCH] virtio: console: Use str_yes_no() helper in port_debugfs_show()

2025-02-12 Thread Thorsten Blum
Remove hard-coded strings by using the str_yes_no() helper function. Signed-off-by: Thorsten Blum --- drivers/char/virtio_console.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c index 24442485e73e

[PATCH] rpmsg: Use strscpy() instead of strscpy_pad()

2025-04-07 Thread Thorsten Blum
using sizeof() when the argument is omitted. RPMSG_NAME_SIZE is equal to sizeof(rpdev->id.name) and can be removed - remove it. No functional changes intended. Signed-off-by: Thorsten Blum --- drivers/rpmsg/qcom_glink_native.c | 2 +- drivers/rpmsg/qcom_smd.c | 2 +- 2 files changed

[RESEND PATCH] rpmsg: Use strscpy() instead of strscpy_pad()

2025-04-29 Thread Thorsten Blum
using sizeof() when the argument is omitted. RPMSG_NAME_SIZE is equal to sizeof(rpdev->id.name) and can be removed - remove it. No functional changes intended. Signed-off-by: Thorsten Blum --- drivers/rpmsg/qcom_glink_native.c | 2 +- drivers/rpmsg/qcom_smd.c | 2 +- 2 files changed

[PATCH] module: Remove unnecessary size argument when calling strscpy()

2025-03-08 Thread Thorsten Blum
The size parameter is optional and strscpy() automatically determines the length of the destination buffer using sizeof() if the argument is omitted. This makes the explicit sizeof() unnecessary. Remove it to shorten and simplify the code. Signed-off-by: Thorsten Blum --- kernel/module/main.c

Re: [RESEND PATCH] rpmsg: Use strscpy() instead of strscpy_pad()

2025-06-10 Thread Thorsten Blum
Hi Mathieu, On 30. Apr 2025, at 16:59, Mathieu Poirier wrote: > On Tue, 29 Apr 2025 at 04:46, Thorsten Blum wrote: >> >> kzalloc() already zero-initializes the destination buffer, making >> strscpy() sufficient for safely copying the name. The additional NUL- >> paddi