Re: [PATCH RESEND] mux: Convert mux_control_ops to a flex array member in mux_chip

2025-06-18 Thread Thorsten Blum
On 10. Jun 2025, at 12:40, Thorsten Blum wrote: > Convert mux_control_ops to a flexible array member at the end of the > mux_chip struct and add the __counted_by() compiler attribute to > improve access bounds-checking via CONFIG_UBSAN_BOUNDS and > CONFIG_FORTIFY_SOURCE. > > Us

[PATCH RESEND] mux: Convert mux_control_ops to a flex array member in mux_chip

2025-06-10 Thread Thorsten Blum
and to remove the following Coccinelle/coccicheck warning: WARNING: Use struct_size Use size_add() to safely add any extra bytes. No functional changes intended. Link: https://github.com/KSPP/linux/issues/83 Signed-off-by: Thorsten Blum --- drivers/mux/core.c | 7 +++ include

[PATCH RESEND] sparc: PCI: Replace deprecated strcpy() with strscpy()

2025-05-21 Thread Thorsten Blum
strcpy() is deprecated; use strscpy() instead. No functional changes intended. Link: https://github.com/KSPP/linux/issues/88 Signed-off-by: Thorsten Blum --- arch/sparc/kernel/pcic.c | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/arch/sparc/kernel/pcic.c b/arch

[PATCH] powerpc/rtas: Replace one-element array with flexible array member

2025-05-13 Thread Thorsten Blum
/KSPP/linux/issues/79 Link: https://github.com/KSPP/linux/issues/83 Signed-off-by: Thorsten Blum --- arch/powerpc/include/asm/rtas-types.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/include/asm/rtas-types.h b/arch/powerpc/include/asm/rtas-types.h index

[PATCH RESEND] nios2: Replace strcpy() with strscpy() and simplify setup_cpuinfo()

2025-05-09 Thread Thorsten Blum
strscpy() and the same buffer into a single statement to simplify the code. No functional changes intended. Link: https://github.com/KSPP/linux/issues/88 Cc: linux-hardening@vger.kernel.org Reviewed-by: Kees Cook Signed-off-by: Thorsten Blum --- arch/nios2/kernel/cpuinfo.c | 5 + 1 file

[PATCH] ovl: Annotate struct ovl_entry with __counted_by()

2025-05-03 Thread Thorsten Blum
Add the __counted_by() compiler attribute to the flexible array member '__lowerstack' to improve access bounds-checking via CONFIG_UBSAN_BOUNDS and CONFIG_FORTIFY_SOURCE. Signed-off-by: Thorsten Blum --- fs/overlayfs/ovl_entry.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)

Re: [RESEND PATCH] mux: Convert mux_control_ops to a flex array member in mux_chip

2025-04-29 Thread Thorsten Blum
Peter? On 13. Apr 2025, at 14:42, Thorsten Blum wrote: > On 7. Apr 2025, at 20:20, Kees Cook wrote: >> On Fri, Mar 07, 2025 at 12:32:07PM +0100, Thorsten Blum wrote: >>> On 3. Mar 2025, at 19:44, Kees Cook wrote: >>>> On Mon, Mar 03, 2025 at 12:02:22AM +0100, Thor

[PATCH] x86/cpu: Replace deprecated strcpy() with strscpy()

2025-04-25 Thread Thorsten Blum
strcpy() is deprecated; use strscpy() instead. In cyrix.c, use 'c->x86_model_id' directly and remove the local variable 'buf' to retain the array size of the destination buffer. No functional changes intended. Link: https://github.com/KSPP/linux/issues/88 Signed-off-by: T

[PATCH] MIPS: Replace strcpy() with strscpy() in vpe_elfload()

2025-04-25 Thread Thorsten Blum
strcpy() is deprecated; use strscpy() instead. Link: https://github.com/KSPP/linux/issues/88 Signed-off-by: Thorsten Blum --- arch/mips/kernel/vpe.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/mips/kernel/vpe.c b/arch/mips/kernel/vpe.c index 737d0d4fdcd3

Re: [PATCH] MIPS: BCM63XX: Replace strcpy() with strscpy() in board_prom_init()

2025-04-22 Thread Thorsten Blum
On 22. Apr 2025, at 12:17, Andy Shevchenko wrote: > On Tue, Apr 22, 2025 at 10:27:33AM +0200, Thorsten Blum wrote: >> On 22. Apr 2025, at 10:03, Andy Shevchenko wrote: >>> Can you use --cc OR put this line... >> >> Yes, will do next time. >> >>> Have

Re: [PATCH] MIPS: BCM63XX: Replace strcpy() with strscpy() in board_prom_init()

2025-04-22 Thread Thorsten Blum
Hi Andy, On 22. Apr 2025, at 10:03, Andy Shevchenko wrote: > Can you use --cc OR put this line... Yes, will do next time. > Have you compiled this with `make W=1` with recent GCCs? Yes, I compile-tested it with W=1 and mips64-linux-gnu-gcc 14.2.1. Thanks, Thorsten

[PATCH] MIPS: BCM63XX: Replace strcpy() with strscpy() in board_prom_init()

2025-04-22 Thread Thorsten Blum
strcpy() is deprecated; use strscpy() instead. Link: https://github.com/KSPP/linux/issues/88 Cc: linux-hardening@vger.kernel.org Signed-off-by: Thorsten Blum --- arch/mips/bcm63xx/boards/board_bcm963xx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/mips/bcm63xx

[PATCH] powerpc: Replace strcpy() with strscpy() in proc_ppc64_init()

2025-04-21 Thread Thorsten Blum
.kernel.org Signed-off-by: Thorsten Blum --- arch/powerpc/kernel/proc_powerpc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/kernel/proc_powerpc.c b/arch/powerpc/kernel/proc_powerpc.c index 3816a2bf2b84..d083b4517065 100644 --- a/arch/powerpc/kernel/proc_pow

[PATCH] m68k: mm: Replace strcpy() with strscpy() in hardware_proc_show()

2025-04-21 Thread Thorsten Blum
strcpy() is deprecated; use strscpy() instead. Link: https://github.com/KSPP/linux/issues/88 Cc: linux-hardening@vger.kernel.org Signed-off-by: Thorsten Blum --- arch/m68k/kernel/setup_mm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/m68k/kernel/setup_mm.c b/arch

[PATCH] sparc: PCI: Replace deprecated strcpy() with strscpy()

2025-04-21 Thread Thorsten Blum
strcpy() is deprecated; use strscpy() instead. No functional changes intended. Link: https://github.com/KSPP/linux/issues/88 Cc: linux-hardening@vger.kernel.org Signed-off-by: Thorsten Blum --- arch/sparc/kernel/pcic.c | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a

[PATCH] nios2: Replace strcpy() with strscpy() and simplify setup_cpuinfo()

2025-04-16 Thread Thorsten Blum
strscpy() and the same buffer into a single statement to simplify the code. No functional changes intended. Link: https://github.com/KSPP/linux/issues/88 Cc: linux-hardening@vger.kernel.org Signed-off-by: Thorsten Blum --- arch/nios2/kernel/cpuinfo.c | 5 + 1 file changed, 1 insertion(+), 4

Re: [PATCH] ASoC: cs-amp-lib: Annotate struct cirrus_amp_efi_data with __counted_by()

2025-04-15 Thread Thorsten Blum
On 15. Apr 2025, at 12:56, Mark Brown wrote: > On Tue, Apr 15, 2025 at 11:03:55AM +0200, Thorsten Blum wrote: >> Add the __counted_by() compiler attribute to the flexible array member >> 'data' to improve access bounds-checking via CONFIG_UBSAN_BOUNDS and >>

[PATCH] ASoC: cs-amp-lib: Annotate struct cirrus_amp_efi_data with __counted_by()

2025-04-15 Thread Thorsten Blum
Add the __counted_by() compiler attribute to the flexible array member 'data' to improve access bounds-checking via CONFIG_UBSAN_BOUNDS and CONFIG_FORTIFY_SOURCE. No functional changes intended. Signed-off-by: Thorsten Blum --- include/sound/cs-amp-lib.h | 2 +- 1 file changed, 1

Re: [RESEND PATCH] mux: Convert mux_control_ops to a flex array member in mux_chip

2025-04-13 Thread Thorsten Blum
Hi Peter, On 7. Apr 2025, at 20:20, Kees Cook wrote: > On Fri, Mar 07, 2025 at 12:32:07PM +0100, Thorsten Blum wrote: >> On 3. Mar 2025, at 19:44, Kees Cook wrote: >>> On Mon, Mar 03, 2025 at 12:02:22AM +0100, Thorsten Blum wrote: >>>> Convert mux_control_ops to a fl

Re: [PATCH] scsi: elx: sli4: Replace deprecated strncpy() with strscpy()

2025-04-10 Thread Thorsten Blum
On 7. Apr 2025, at 20:28, Kees Cook wrote: > On Wed, Feb 26, 2025 at 07:55:26PM +0100, Thorsten Blum wrote: >> strncpy() is deprecated for NUL-terminated destination buffers; use >> strscpy() instead. >> >> Compile-tested only. >> >> Link: https://githu

[PATCH v2] scsi: elx: sli4: Replace deprecated strncpy() with strscpy()

2025-04-09 Thread Thorsten Blum
(). No functional changes intended. Link: https://github.com/KSPP/linux/issues/90 Cc: linux-hardening@vger.kernel.org Signed-off-by: Thorsten Blum --- Changes in v2: - Update patch description as suggested by Kees - Link to v1: https://lore.kernel.org/lkml/20250226185531.1092-2-thorsten.b

Re: [PATCH] scsi: elx: sli4: Replace deprecated strncpy() with strscpy()

2025-04-07 Thread Thorsten Blum
On 7. Apr 2025, at 22:30, Kees Cook wrote: > On Mon, Apr 07, 2025 at 09:01:53PM +0200, Thorsten Blum wrote: >> On 7. Apr 2025, at 20:28, Kees Cook wrote: >>> On Wed, Feb 26, 2025 at 07:55:26PM +0100, Thorsten Blum wrote: >>>> strncpy() is deprecated for NUL-termi

[PATCH] ALSA: azt2320: Replace deprecated strcpy() with strscpy()

2025-04-07 Thread Thorsten Blum
strcpy() is deprecated, use strscpy() instead. Link: https://github.com/KSPP/linux/issues/88 Cc: linux-hardening@vger.kernel.org Signed-off-by: Thorsten Blum --- sound/isa/azt2320.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sound/isa/azt2320.c b/sound/isa/azt2320.c

[PATCH] USB: gadget: Replace deprecated strncpy() with strscpy()

2025-03-27 Thread Thorsten Blum
. Link: https://github.com/KSPP/linux/issues/90 Cc: linux-hardening@vger.kernel.org Signed-off-by: Thorsten Blum --- drivers/usb/gadget/legacy/inode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/gadget/legacy/inode.c b/drivers/usb/gadget/legacy/inode.c index

[RESEND PATCH] mux: Convert mux_control_ops to a flex array member in mux_chip

2025-03-18 Thread Thorsten Blum
and to remove the following Coccinelle/coccicheck warning: WARNING: Use struct_size Use size_add() to safely add any extra bytes. Compile-tested only. Link: https://github.com/KSPP/linux/issues/83 Signed-off-by: Thorsten Blum --- drivers/mux/core.c | 7 +++ include/linux/mux

Re: [RESEND PATCH] mux: Convert mux_control_ops to a flex array member in mux_chip

2025-03-07 Thread Thorsten Blum
On 3. Mar 2025, at 19:44, Kees Cook wrote: > On Mon, Mar 03, 2025 at 12:02:22AM +0100, Thorsten Blum wrote: >> Convert mux_control_ops to a flexible array member at the end of the >> mux_chip struct and add the __counted_by() compiler attribute to >> improve acces

[PATCH] module: Replace deprecated strncpy() with strscpy()

2025-03-07 Thread Thorsten Blum
/issues/90 Cc: linux-hardening@vger.kernel.org Signed-off-by: Thorsten Blum --- kernel/module/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/module/main.c b/kernel/module/main.c index 1fb9ad289a6f..2b88c91c89e3 100644 --- a/kernel/module/main.c +++ b/kernel/mod

Re: [tip: perf/core] perf/x86: Annotate struct bts_buffer with __counted_by()

2025-03-05 Thread Thorsten Blum
On 5. Mar 2025, at 12:02, Ingo Molnar wrote: > * Thorsten Blum wrote: >> On 5. Mar 2025, at 10:18, Ingo Molnar wrote: >>> Actually, on a second thought: >>> >>>> - buf = kzalloc_node(offsetof(struct bts_buffer, buf[nbuf]), GFP_KERNEL, >>>> no

[PATCH v2] perf/x86: Annotate struct bts_buffer with __counted_by()

2025-03-05 Thread Thorsten Blum
Add the __counted_by() compiler attribute to the flexible array member buf to improve access bounds-checking via CONFIG_UBSAN_BOUNDS and CONFIG_FORTIFY_SOURCE. No functional changes intended. Signed-off-by: Thorsten Blum --- Changes in v2: - struct_size() changes should be a separate patch as

[PATCH] perf/x86: Annotate struct bts_buffer with __counted_by()

2025-03-05 Thread Thorsten Blum
compile-time checks (e.g., __must_be_array()). No functional changes intended. Signed-off-by: Thorsten Blum --- arch/x86/events/intel/bts.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/x86/events/intel/bts.c b/arch/x86/events/intel/bts.c index 8f78b0c900ef

Re: [tip: perf/core] perf/x86: Annotate struct bts_buffer with __counted_by()

2025-03-05 Thread Thorsten Blum
On 5. Mar 2025, at 10:18, Ingo Molnar wrote: > Actually, on a second thought: > >> - buf = kzalloc_node(offsetof(struct bts_buffer, buf[nbuf]), GFP_KERNEL, >> node); >> + buf = kzalloc_node(struct_size(buf, buf, nbuf), GFP_KERNEL, node); > > Firstly, in what world is 'buf, buf' more readable? On

[PATCH] xfs: Replace deprecated strncpy() with strscpy()

2025-03-05 Thread Thorsten Blum
strncpy() is deprecated for NUL-terminated destination buffers. Use strscpy() instead and remove the manual NUL-termination. No functional changes intended. Link: https://github.com/KSPP/linux/issues/90 Cc: linux-hardening@vger.kernel.org Signed-off-by: Thorsten Blum --- fs/xfs/xfs_xattr.c | 4

Re: [PATCH] xfs: Replace deprecated strncpy() with strscpy()

2025-03-04 Thread Thorsten Blum
On 5. Mar 2025, at 03:21, Darrick J. Wong wrote: > On Wed, Mar 05, 2025 at 02:10:21AM +0100, Thorsten Blum wrote: >> strncpy() is deprecated for NUL-terminated destination buffers. Use >> strscpy() instead and remove the manual NUL-termination. >> >> No functional ch

Re: [RESEND PATCH] mux: Convert mux_control_ops to a flex array member in mux_chip

2025-03-04 Thread Thorsten Blum
On 3. Mar 2025, at 19:44, Kees Cook wrote: > On Mon, Mar 03, 2025 at 12:02:22AM +0100, Thorsten Blum wrote: >> Convert mux_control_ops to a flexible array member at the end of the >> mux_chip struct and add the __counted_by() compiler attribute to >> improve acces

[RESEND PATCH] mux: Convert mux_control_ops to a flex array member in mux_chip

2025-03-02 Thread Thorsten Blum
and to remove the following Coccinelle/coccicheck warning: WARNING: Use struct_size Use size_add() to safely add any extra bytes. Compile-tested only. Link: https://github.com/KSPP/linux/issues/83 Signed-off-by: Thorsten Blum --- drivers/mux/core.c | 7 +++ include/linux/mux

[PATCH v2] scsi: target: Replace deprecated strncpy() with strscpy()

2025-03-02 Thread Thorsten Blum
c: linux-hardening@vger.kernel.org Signed-off-by: Thorsten Blum --- Changes in v2: - Improve the commit message and replace another strncpy() as suggested by Kees Cook - Replace snprintf() with scnprintf() - Link to v1: https://lore.kernel.org/r/20250226121003.359876-1-thorsten.b...@linux.dev/ -

Re: [PATCH] scsi: target: Replace deprecated strncpy() with strscpy()

2025-03-02 Thread Thorsten Blum
On 28. Feb 2025, at 21:10, Kees Cook wrote: > On Wed, Feb 26, 2025 at 01:10:03PM +0100, Thorsten Blum wrote: >> Since strncpy() is deprecated for NUL-terminated destination buffers, >> use strscpy() instead. >> >> Compile-tested only. >> >> Link: https:

Re: [PATCH] hwmon: (pmbus/core) Replace deprecated strncpy() with strscpy()

2025-02-28 Thread Thorsten Blum
On 27. Feb 2025, at 23:37, Guenter Roeck wrote: > On 2/27/25 09:39, Thorsten Blum wrote: >> strncpy() is deprecated for NUL-terminated destination buffers; use >> strscpy() instead. >> Compile-tested only. >> Link: https://github.com/KSPP/linux/issues/90 >> Cc

[PATCH] hwmon: (pmbus/core) Replace deprecated strncpy() with strscpy()

2025-02-27 Thread Thorsten Blum
strncpy() is deprecated for NUL-terminated destination buffers; use strscpy() instead. Compile-tested only. Link: https://github.com/KSPP/linux/issues/90 Cc: linux-hardening@vger.kernel.org Signed-off-by: Thorsten Blum --- drivers/hwmon/pmbus/pmbus_core.c | 3 +-- 1 file changed, 1 insertion

[PATCH] scsi: elx: sli4: Replace deprecated strncpy() with strscpy()

2025-02-26 Thread Thorsten Blum
strncpy() is deprecated for NUL-terminated destination buffers; use strscpy() instead. Compile-tested only. Link: https://github.com/KSPP/linux/issues/90 Cc: linux-hardening@vger.kernel.org Signed-off-by: Thorsten Blum --- drivers/scsi/elx/libefc_sli/sli4.c | 6 +++--- 1 file changed, 3

[PATCH] scsi: target: Replace deprecated strncpy() with strscpy()

2025-02-26 Thread Thorsten Blum
Since strncpy() is deprecated for NUL-terminated destination buffers, use strscpy() instead. Compile-tested only. Link: https://github.com/KSPP/linux/issues/90 Cc: linux-hardening@vger.kernel.org Signed-off-by: Thorsten Blum --- drivers/target/target_core_configfs.c | 2 +- 1 file changed, 1

[PATCH] platform/x86: hp-bioscfg: Replace deprecated strncpy() with strscpy()

2025-02-25 Thread Thorsten Blum
Since kstrtol() requires a NUL-terminated string as input and strncpy() is deprecated for NUL-terminated destination buffers, use strscpy() instead. Compile-tested only. Link: https://github.com/KSPP/linux/issues/90 Cc: linux-hardening@vger.kernel.org Signed-off-by: Thorsten Blum --- drivers

[PATCH] MIPS: Loongson2ef: Replace deprecated strncpy() with strscpy()

2025-02-24 Thread Thorsten Blum
strncpy() is deprecated for NUL-terminated destination buffers. Use strscpy() instead and remove the manual NUL-termination. Compile-tested only. Link: https://github.com/KSPP/linux/issues/90 Cc: linux-hardening@vger.kernel.org Signed-off-by: Thorsten Blum --- arch/mips/loongson2ef/common

[PATCH] mux: Convert mux_control_ops to a flex array member in mux_chip

2025-02-21 Thread Thorsten Blum
and to remove the following Coccinelle/coccicheck warning: WARNING: Use struct_size Use size_add() to safely add any extra bytes. Compile-tested only. Link: https://github.com/KSPP/linux/issues/83 Signed-off-by: Thorsten Blum --- drivers/mux/core.c | 7 +++ include/linux/mux

Re: [PATCH net-next] net/rds: Replace deprecated strncpy() with strscpy_pad()

2025-02-19 Thread Thorsten Blum
On 20. Feb 2025, at 03:57, Kees Cook wrote: > On Wed, Feb 19, 2025 at 11:47:31PM +0100, Thorsten Blum wrote: >> strncpy() is deprecated for NUL-terminated destination buffers. Use >> strscpy_pad() instead and remove the manual NUL-termination. > > When doing these conversions

[PATCH net-next] net/rds: Replace deprecated strncpy() with strscpy_pad()

2025-02-19 Thread Thorsten Blum
strncpy() is deprecated for NUL-terminated destination buffers. Use strscpy_pad() instead and remove the manual NUL-termination. Compile-tested only. Link: https://github.com/KSPP/linux/issues/90 Cc: linux-hardening@vger.kernel.org Signed-off-by: Thorsten Blum --- net/rds/stats.c | 3 +-- 1

[PATCH v3] scsi: hpsa: Remove deprecated and unnecessary strncpy()

2025-02-14 Thread Thorsten Blum
Suggested-by: Bart Van Assche Signed-off-by: Thorsten Blum --- Changes in v2: - Adjust len to copy the same number of bytes as with strncpy() - Link to v1: https://lore.kernel.org/r/2025021214.86110-2-thorsten.b...@linux.dev/ Changes in v3: - Remove strncpy() and tmpbuf et al and use buf

[RESEND PATCH v2] params: Annotate struct module_param_attrs with __counted_by()

2025-02-13 Thread Thorsten Blum
: Luis Chamberlain Cc: Nathan Chancellor Signed-off-by: Thorsten Blum --- Changes in v2: - Use krealloc_array() as suggested by Andy Shevchenko - Link to v1: https://lore.kernel.org/r/20240823123300.37574-1-thorsten.b...@toblux.com/ Resending again after Luis mentioned that co-maintainers are r

[PATCH v2] scsi: hpsa: Replace deprecated strncpy() with strscpy()

2025-02-13 Thread Thorsten Blum
Assche Signed-off-by: Thorsten Blum --- Changes in v2: - Adjust len to copy the same number of bytes as with strncpy() - Link to v1: https://lore.kernel.org/r/34bb4fde-062d-4c1b-b246-86cb55f63...@linux.dev/ --- drivers/scsi/hpsa.c | 10 -- 1 file changed, 4 insertions(+), 6 deletions

Re: [PATCH] scsi: hpsa: Replace deprecated strncpy() with strscpy_pad()

2025-02-13 Thread Thorsten Blum
On 13. Feb 2025, at 20:14, David Laight wrote: > On Wed, 12 Feb 2025 23:43:53 +0100 > Thorsten Blum wrote: > >> strncpy() is deprecated for NUL-terminated destination buffers [1]. >> >> Replace memset() and strncpy() with strscpy_pad() to copy the version >> st

[PATCH] m68k: mm: Replace deprecated strncpy() with strscpy()

2025-02-13 Thread Thorsten Blum
strncpy() is deprecated for NUL-terminated destination buffers. Use strscpy() instead and remove the manual NUL-termination. Compile-tested only. Link: https://github.com/KSPP/linux/issues/90 Cc: linux-hardening@vger.kernel.org Signed-off-by: Thorsten Blum --- arch/m68k/kernel/setup_mm.c | 3

[PATCH v2] scsi: hpsa: Replace deprecated strncpy() with strscpy_pad()

2025-02-13 Thread Thorsten Blum
: https://github.com/KSPP/linux/issues/90 Cc: linux-hardening@vger.kernel.org Signed-off-by: Thorsten Blum --- Changes in v2: - Use len instead of len - 1 - Link to v1: https://lore.kernel.org/r/20250212224352.86583-3-thorsten.b...@linux.dev/ --- drivers/scsi/hpsa.c | 3 +-- 1 file changed, 1

Re: [PATCH] scsi: hpsa: Replace deprecated strncpy() with strscpy()

2025-02-13 Thread Thorsten Blum
On 12. Feb 2025, at 23:22, Thorsten Blum wrote: > strncpy() is deprecated for NUL-terminated destination buffers [1]. Use > strscpy() instead and remove the manual NUL-termination. > > Use min() to simplify the size calculation. > > Compile-tested only. > > Link: >

[PATCH] scsi: hpsa: Replace deprecated strncpy() with strscpy_pad()

2025-02-12 Thread Thorsten Blum
. Link: https://www.kernel.org/doc/html/latest/process/deprecated.html#strncpy-on-nul-terminated-strings [1] Cc: linux-hardening@vger.kernel.org Signed-off-by: Thorsten Blum --- drivers/scsi/hpsa.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/scsi/hpsa.c b/drivers

[PATCH] scsi: hpsa: Replace deprecated strncpy() with strscpy()

2025-02-12 Thread Thorsten Blum
-strings [1] Cc: linux-hardening@vger.kernel.org Signed-off-by: Thorsten Blum Suggested-by: Bart Van Assche --- drivers/scsi/hpsa.c | 10 -- 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c index 84d8de07b7ae..9399e101f150 100644 --- a

Re: [RESEND PATCH v2] params: Annotate struct module_param_attrs with __counted_by()

2025-02-11 Thread Thorsten Blum
On 4. Feb 2025, at 17:44, Thorsten Blum wrote: > On 14. Jan 2025, at 22:49, Thorsten Blum wrote: >> Add the __counted_by compiler attribute to the flexible array member >> attrs to improve access bounds-checking via CONFIG_UBSAN_BOUNDS and >> CONFIG_FORTIFY_SOURCE. >&g

Re: [RESEND PATCH v2] params: Annotate struct module_param_attrs with __counted_by()

2025-02-04 Thread Thorsten Blum
On 14. Jan 2025, at 22:49, Thorsten Blum wrote: > Add the __counted_by compiler attribute to the flexible array member > attrs to improve access bounds-checking via CONFIG_UBSAN_BOUNDS and > CONFIG_FORTIFY_SOURCE. > > Increment num before adding a new param_attribute to the

[PATCH v2] hv_netvsc: Replace one-element array with flexible array member

2025-01-16 Thread Thorsten Blum
: Thorsten Blum --- Changes in v2: - Replace sizeof() with struct_size_t(,,1) to maintain the same size after feedback from Roman Kisel (thanks!) - Link to v1: https://lore.kernel.org/r/20250116201635.47870-2-thorsten.b...@linux.dev/ --- drivers/net/hyperv/hyperv_net.h | 2 +- drivers/net/hyperv

Re: [PATCH] hv_netvsc: Replace one-element array with flexible array member

2025-01-16 Thread Thorsten Blum
On 16. Jan 2025, at 21:45, Roman Kisel wrote: > On 1/16/2025 12:16 PM, Thorsten Blum wrote: >> Replace the deprecated one-element array with a modern flexible array >> member in the struct nvsp_1_message_send_receive_buffer_complete. >> Link: https://github.com/KSPP/linux/is

[PATCH] hv_netvsc: Replace one-element array with flexible array member

2025-01-16 Thread Thorsten Blum
Replace the deprecated one-element array with a modern flexible array member in the struct nvsp_1_message_send_receive_buffer_complete. Link: https://github.com/KSPP/linux/issues/79 Signed-off-by: Thorsten Blum --- drivers/net/hyperv/hyperv_net.h | 2 +- 1 file changed, 1 insertion(+), 1

[PATCH] s390/vfio-ap: Replace one-element array with flexible array member

2025-01-16 Thread Thorsten Blum
Replace the deprecated one-element array with a modern flexible array member in the struct ap_matrix_dev. Use struct_size() to calculate the number of bytes to allocate for matrix_dev with a single mdev_type. Link: https://github.com/KSPP/linux/issues/79 Signed-off-by: Thorsten Blum

[RESEND PATCH v2] params: Annotate struct module_param_attrs with __counted_by()

2025-01-14 Thread Thorsten Blum
: Luis Chamberlain Cc: Nathan Chancellor Signed-off-by: Thorsten Blum --- Changes in v2: - Use krealloc_array() as suggested by Andy Shevchenko - Link to v1: https://lore.kernel.org/r/20240823123300.37574-1-thorsten.b...@toblux.com/ --- kernel/params.c | 29 +

[RESEND PATCH v2] params: Annotate struct module_param_attrs with __counted_by()

2025-01-07 Thread Thorsten Blum
: Luis Chamberlain Cc: Nathan Chancellor Signed-off-by: Thorsten Blum --- Changes in v2: - Use krealloc_array() as suggested by Andy Shevchenko - Link to v1: https://lore.kernel.org/r/20240823123300.37574-1-thorsten.b...@toblux.com/ --- kernel/params.c | 29 +

[PATCH] stackleak: Use str_enabled_disabled() helper in stack_erasing_sysctl()

2024-12-22 Thread Thorsten Blum
Remove hard-coded strings by using the str_enabled_disabled() helper function. Signed-off-by: Thorsten Blum --- kernel/stackleak.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/kernel/stackleak.c b/kernel/stackleak.c index 39fd620a7db6..0f4804f28c61 100644 --- a/kernel

[RESEND PATCH v2] params: Annotate struct module_param_attrs with __counted_by()

2024-12-21 Thread Thorsten Blum
after the first reallocation such that the reallocation for the NULL terminator only needs to add 1 (instead of 2) to mk->mp->num. Use struct_size() instead of manually calculating the size for the reallocation. Use krealloc_array() for the additional NULL terminator. Signed-off-by: Thorste

[RESEND PATCH] sctp: Replace zero-length array with flexible array member

2024-12-20 Thread Thorsten Blum
Replace the deprecated zero-length array with a modern flexible array member in the struct sctp_idatahdr. Link: https://github.com/KSPP/linux/issues/78 Reviewed-by: Kees Cook Signed-off-by: Thorsten Blum --- include/linux/sctp.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git

Re: [PATCH] hv: hyperv.h: Annotate vmbus_channel_gpadl_header with __counted_by()

2024-12-08 Thread Thorsten Blum
On 7. Dec 2024, at 08:48, Wei Liu wrote: > On Tue, Oct 15, 2024 at 12:18:29PM +0200, Thorsten Blum wrote: >> Add the __counted_by compiler attribute to the flexible array member >> range to improve access bounds-checking via CONFIG_UBSAN_BOUNDS and >> CONFIG_FORTIFY_SOURCE.

[PATCH] sctp: Replace zero-length array with flexible array member

2024-11-16 Thread Thorsten Blum
Replace the deprecated zero-length array with a modern flexible array member in the struct sctp_idatahdr. Link: https://github.com/KSPP/linux/issues/78 Signed-off-by: Thorsten Blum --- include/linux/sctp.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/sctp.h

Re: [PATCH v2] ext4: Annotate struct fname with __counted_by()

2024-11-14 Thread Thorsten Blum
On 14. Nov 2024, at 14:53, Theodore Ts'o wrote: > By the way, in general, you don't need to resend patches unless you > need to rebase them to fix patch conflicts; I track requested patches > using patchwork, and I tend to process and review patches in batches. > > If you are concerned that I migh

[RESEND PATCH v2] ext4: Annotate struct fname with __counted_by()

2024-11-12 Thread Thorsten Blum
Add the __counted_by compiler attribute to the flexible array member name to improve access bounds-checking via CONFIG_UBSAN_BOUNDS and CONFIG_FORTIFY_SOURCE. Reviewed-by: Jan Kara Signed-off-by: Thorsten Blum --- Changes in v2: - Split the patch into two separate patches as suggested by Greg

Re: [PATCH v2] sparc: Replace one-element array with flexible array member

2024-11-12 Thread Thorsten Blum
On 11. Nov 2024, at 21:47, Thorsten Blum wrote: > Replace the deprecated one-element array with a modern flexible array > member in the struct hvtramp_descr. > > Additionally, 15 unnecessary bytes were allocated for hdesc, but instead > of fixing the parentheses in the open-cod

[PATCH v2] sparc: Replace one-element array with flexible array member

2024-11-11 Thread Thorsten Blum
: https://github.com/KSPP/linux/issues/79 Signed-off-by: Thorsten Blum --- Changes in v2: - Fix the number of mappings after feedback from Gustavo A. R. Silva - Link to v1: https://lore.kernel.org/r/2024200155.164621-3-thorsten.b...@linux.dev/ --- arch/sparc/include/asm/hvtramp.h | 2 +- arch

Re: [PATCH] sparc: Replace one-element array with flexible array member

2024-11-11 Thread Thorsten Blum
On 11. Nov 2024, at 21:20, Gustavo A. R. Silva wrote: > On 11/11/24 14:01, Thorsten Blum wrote: >> Replace the deprecated one-element array with a modern flexible array >> member in the struct hvtramp_descr. >> Additionally, 15 unnecessary bytes are allocated for hdesc

[PATCH] sparc: Replace one-element array with flexible array member

2024-11-11 Thread Thorsten Blum
: https://github.com/KSPP/linux/issues/79 Signed-off-by: Thorsten Blum --- arch/sparc/include/asm/hvtramp.h | 2 +- arch/sparc/kernel/smp_64.c | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/arch/sparc/include/asm/hvtramp.h b/arch/sparc/include/asm/hvtramp.h index

[PATCH v2] scsi: Replace zero-length array with flexible array member

2024-11-10 Thread Thorsten Blum
Replace the deprecated zero-length array with a modern flexible array member in the struct iscsi_bsg_host_vendor_reply. Link: https://github.com/KSPP/linux/issues/78 Signed-off-by: Thorsten Blum --- Changes in v2: - Use DECLARE_FLEX_ARRAY() as suggested by Gustavo A. R. Silva - Link to v1

[PATCH] scsi: Replace zero-length array with flexible array member

2024-11-10 Thread Thorsten Blum
Replace the deprecated zero-length array with a modern flexible array member in the struct iscsi_bsg_host_vendor_reply. Link: https://github.com/KSPP/linux/issues/78 Signed-off-by: Thorsten Blum --- include/scsi/scsi_bsg_iscsi.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git

[RESEND PATCH] nfs: Annotate struct pnfs_commit_array with __counted_by()

2024-11-07 Thread Thorsten Blum
Add the __counted_by compiler attribute to the flexible array member buckets to improve access bounds-checking via CONFIG_UBSAN_BOUNDS and CONFIG_FORTIFY_SOURCE. Compile-tested only. Signed-off-by: Thorsten Blum --- include/linux/nfs_xdr.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion

Re: [RESEND PATCH] ext4: Annotate struct fname with __counted_by()

2024-11-05 Thread Thorsten Blum
On 5. Nov 2024, at 10:52, Greg KH wrote: > On Tue, Nov 05, 2024 at 12:42:14AM +0100, Thorsten Blum wrote: >> Add the __counted_by compiler attribute to the flexible array member >> name to improve access bounds-checking via CONFIG_UBSAN_BOUNDS and >> CONFIG_FORTIFY_SOURCE.

[PATCH v2] ext4: Annotate struct fname with __counted_by()

2024-11-05 Thread Thorsten Blum
Add the __counted_by compiler attribute to the flexible array member name to improve access bounds-checking via CONFIG_UBSAN_BOUNDS and CONFIG_FORTIFY_SOURCE. Reviewed-by: Jan Kara Signed-off-by: Thorsten Blum --- Changes in v2: - Split the patch into two separate patches as suggested by Greg

[RESEND PATCH] ext4: Annotate struct fname with __counted_by()

2024-11-04 Thread Thorsten Blum
Kara Signed-off-by: Thorsten Blum --- fs/ext4/dir.c | 7 +++ 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/fs/ext4/dir.c b/fs/ext4/dir.c index ef6a3c8f3a9a..02d47a64e8d1 100644 --- a/fs/ext4/dir.c +++ b/fs/ext4/dir.c @@ -418,7 +418,7 @@ struct fname { __u32

[PATCH] freevxfs: Replace one-element array with flexible array member

2024-11-03 Thread Thorsten Blum
Replace the deprecated one-element array with a modern flexible array member in the struct vxfs_dirblk. Link: https://github.com/KSPP/linux/issues/79 Signed-off-by: Thorsten Blum --- fs/freevxfs/vxfs_dir.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/freevxfs

Re: [PATCH v2] params: Annotate struct module_param_attrs with __counted_by()

2024-11-01 Thread Thorsten Blum
On 1. Nov 2024, at 13:26, Andy Shevchenko wrote: > On Fri, Aug 23, 2024 at 04:59:33PM +0200, Thorsten Blum wrote: >> Add the __counted_by compiler attribute to the flexible array member >> attrs to improve access bounds-checking via CONFIG_UBSAN_BOUNDS and >>

Re: [PATCH 1/1] Compiler Attributes: disable __counted_by for clang < 19.1.3

2024-10-29 Thread Thorsten Blum
or > Tested-by: Nathan Chancellor > Reviewed-by: Miguel Ojeda Thanks for fixing this and your work on the Clang issues. Feel free to add: Reviewed-by: Thorsten Blum

[RESEND PATCH] nfs: Annotate struct pnfs_commit_array with __counted_by()

2024-10-28 Thread Thorsten Blum
Add the __counted_by compiler attribute to the flexible array member buckets to improve access bounds-checking via CONFIG_UBSAN_BOUNDS and CONFIG_FORTIFY_SOURCE. Compile-tested only. Signed-off-by: Thorsten Blum --- include/linux/nfs_xdr.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion

[PATCH] coccinelle: Add str_off_on() and str_no_yes() rules

2024-10-27 Thread Thorsten Blum
In addition to str_on_off() and str_yes_no(), add rules to search for str_off_on() and str_no_yes() replacements. Signed-off-by: Thorsten Blum --- scripts/coccinelle/api/string_choices.cocci | 38 + 1 file changed, 38 insertions(+) diff --git a/scripts/coccinelle/api

[RESEND PATCH] ext4: Annotate struct fname with __counted_by()

2024-10-22 Thread Thorsten Blum
: Thorsten Blum Reviewed-by: Jan Kara --- fs/ext4/dir.c | 7 +++ 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/fs/ext4/dir.c b/fs/ext4/dir.c index ef6a3c8f3a9a..02d47a64e8d1 100644 --- a/fs/ext4/dir.c +++ b/fs/ext4/dir.c @@ -418,7 +418,7 @@ struct fname { __u32

[PATCH v2] acl: Annotate struct posix_acl with __counted_by()

2024-10-18 Thread Thorsten Blum
the posix_acl_alloc() function parameter count from int to unsigned int to match posix_acl's a_count data type. Add identifier names to the function definition to silence two checkpatch warnings. Reviewed-by: Jan Kara Signed-off-by: Thorsten Blum Cc: Nathan Chancellor --- Changes in v2: - U

[RESEND PATCH] nfs: Annotate struct pnfs_commit_array with __counted_by()

2024-10-15 Thread Thorsten Blum
Add the __counted_by compiler attribute to the flexible array member buckets to improve access bounds-checking via CONFIG_UBSAN_BOUNDS and CONFIG_FORTIFY_SOURCE. Compile-tested only. Signed-off-by: Thorsten Blum --- include/linux/nfs_xdr.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion

[PATCH] hv: hyperv.h: Annotate vmbus_channel_gpadl_header with __counted_by()

2024-10-15 Thread Thorsten Blum
Add the __counted_by compiler attribute to the flexible array member range to improve access bounds-checking via CONFIG_UBSAN_BOUNDS and CONFIG_FORTIFY_SOURCE. Compile-tested only. Signed-off-by: Thorsten Blum --- include/linux/hyperv.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion

[RESEND PATCH] ext4: Annotate struct fname with __counted_by()

2024-10-07 Thread Thorsten Blum
: Thorsten Blum Reviewed-by: Jan Kara --- fs/ext4/dir.c | 7 +++ 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/fs/ext4/dir.c b/fs/ext4/dir.c index ef6a3c8f3a9a..02d47a64e8d1 100644 --- a/fs/ext4/dir.c +++ b/fs/ext4/dir.c @@ -418,7 +418,7 @@ struct fname { __u32

[RESEND PATCH] MAINTAINERS: Add kernel hardening keywords __counted_by{_le|_be}

2024-10-07 Thread Thorsten Blum
In addition to __counted_by, also match the keywords __counted_by_le and __counted_by_be. Signed-off-by: Thorsten Blum --- MAINTAINERS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MAINTAINERS b/MAINTAINERS index 84086d47db69..475387503391 100644 --- a/MAINTAINERS +++ b

Re: [PATCH] acl: Annotate struct posix_acl with __counted_by()

2024-10-04 Thread Thorsten Blum
On 2. Oct 2024, at 05:42, Nathan Chancellor wrote: > On Thu, Sep 26, 2024 at 02:21:42PM +0200, Thorsten Blum wrote: >> On 26. Sep 2024, at 03:46, kernel test robot wrote: >>> >>> Hello, >>> >>> kernel test robot noticed >>>

[PATCH] ipc/msg: Replace one-element array with flexible array member

2024-09-30 Thread Thorsten Blum
Replace the deprecated one-element array with a modern flexible array member in the struct compat_msgbuf. There are no binary differences after this conversion. Link: https://github.com/KSPP/linux/issues/79 Signed-off-by: Thorsten Blum --- ipc/msg.c | 2 +- 1 file changed, 1 insertion(+), 1

[PATCH] nfs: Annotate struct pnfs_commit_array with __counted_by()

2024-09-30 Thread Thorsten Blum
Add the __counted_by compiler attribute to the flexible array member buckets to improve access bounds-checking via CONFIG_UBSAN_BOUNDS and CONFIG_FORTIFY_SOURCE. Compile-tested only. Signed-off-by: Thorsten Blum --- include/linux/nfs_xdr.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion

Re: [PATCH] acl: Annotate struct posix_acl with __counted_by()

2024-09-26 Thread Thorsten Blum
l with __counted_by()") > url: > https://github.com/intel-lab-lkp/linux/commits/Thorsten-Blum/acl-Annotate-struct-posix_acl-with-__counted_by/20240924-054002 > base: https://git.kernel.org/cgit/linux/kernel/git/vfs/vfs.git vfs.all > patch link: > https://lore.kernel.org/all/20240

[PATCH v2] ksmbd: Annotate struct copychunk_ioctl_req with __counted_by_le()

2024-09-25 Thread Thorsten Blum
ested only. Signed-off-by: Thorsten Blum --- Changes in v2: - Change the data type of Chunks from __u8[] to struct srv_copychunk[] as suggested by Tom Talpey - Use struct_size() - Link to v1: https://lore.kernel.org/linux-kernel/20240924102243.239811-2-thorsten.b...@linux.dev/ --- fs/smb/s

Re: [PATCH] ksmbd: Annotate struct copychunk_ioctl_req with __counted_by_le()

2024-09-24 Thread Thorsten Blum
On 24. Sep 2024, at 21:33, Thorsten Blum wrote: >> On 24. Sep 2024, at 20:05, Tom Talpey wrote: >> On 9/24/2024 6:22 AM, Thorsten Blum wrote: >>> Add the __counted_by_le compiler attribute to the flexible array member >>> Chunks to improve access bounds-checki

Re: [PATCH] ksmbd: Annotate struct copychunk_ioctl_req with __counted_by_le()

2024-09-24 Thread Thorsten Blum
Hi Tom, > On 24. Sep 2024, at 20:05, Tom Talpey wrote: > On 9/24/2024 6:22 AM, Thorsten Blum wrote: >> Add the __counted_by_le compiler attribute to the flexible array member >> Chunks to improve access bounds-checking via CONFIG_UBSAN_BOUNDS and >> CONFIG_FORTIFY_SOURCE.

[PATCH] ksmbd: Annotate struct copychunk_ioctl_req with __counted_by_le()

2024-09-24 Thread Thorsten Blum
Add the __counted_by_le compiler attribute to the flexible array member Chunks to improve access bounds-checking via CONFIG_UBSAN_BOUNDS and CONFIG_FORTIFY_SOURCE. Read Chunks[0] after checking that ChunkCount is not 0. Compile-tested only. Signed-off-by: Thorsten Blum --- fs/smb/server

[PATCH] MAINTAINERS: Add kernel hardening keywords __counted_by{_le|_be}

2024-09-24 Thread Thorsten Blum
In addition to __counted_by, also match the keywords __counted_by_le and __counted_by_be. Signed-off-by: Thorsten Blum --- MAINTAINERS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MAINTAINERS b/MAINTAINERS index 911d573f7779..aff8b04b5eac 100644 --- a/MAINTAINERS +++ b

  1   2   >