Re: [PATCH] mxser: Annotate struct mxser_board with __counted_by

2023-09-25 Thread Jiri Slaby
CONFIG_FORTIFY_SOURCE (for strcpy/memcpy-family functions). As found with Coccinelle[1], add __counted_by for struct mxser_board. [1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci Reviewed-by: Jiri Slaby thanks, -- js suse labs

Re: [PATCH] ath5k: replace deprecated strncpy with strscpy

2023-10-15 Thread Jiri Slaby
nel.org/doc/html/latest/process/deprecated.html#strncpy-on-nul-terminated-strings [1] Link: https://manpages.debian.org/testing/linux-manual-4.8/strscpy.9.en.html [2] Link: https://github.com/KSPP/linux/issues/90 Cc: linux-hardening@vger.kernel.org Signed-off-by: Justin Stitt LGTM Reviewed-by: Jiri Slaby -- js suse labs

Re: [PATCH v2] tty: rfcomm: prefer struct_size over open coded arithmetic

2024-05-12 Thread Jiri Slaby
On 12. 05. 24, 13:17, Erick Archer wrote: This is an effort to get rid of all multiplications from allocation functions in order to prevent integer overflows [1][2]. As the "dl" variable is a pointer to "struct rfcomm_dev_list_req" and this structure ends in a flexible array: ... --- a/include

Re: [PATCH] tty: mxser: Remove __counted_by from mxser_board.ports[]

2024-05-29 Thread Jiri Slaby
On 29. 05. 24, 23:29, Nathan Chancellor wrote: Work for __counted_by on generic pointers in structures (not just flexible array members) has started landing in Clang 19 (current tip of tree). During the development of this feature, a restriction was added to __counted_by to prevent the flexible a

Re: [PATCH] nvmet-fc: Remove __counted_by from nvmet_fc_tgt_queue.fod[]

2024-05-29 Thread Jiri Slaby
On 29. 05. 24, 23:42, Nathan Chancellor wrote: drivers/nvme/target/fc.c:151:2: error: 'counted_by' should not be applied to an array with element of unknown size because 'struct nvmet_fc_fcp_iod' is a struct type with a flexible array member. The same as for mxser_port: struct nvmet_fc_fc

Re: [PATCH] tty: mxser: Remove __counted_by from mxser_board.ports[]

2024-05-30 Thread Jiri Slaby
On 30. 05. 24, 10:12, Gustavo A. R. Silva wrote: On 30/05/24 09:40, Greg Kroah-Hartman wrote: On Thu, May 30, 2024 at 08:22:03AM +0200, Jiri Slaby wrote:   This will be an error in a future compiler version [-Werror,-Wbounds-safety-counted-by-elt-type-unknown-size]   291

Re: [PATCH] tty: mxser: Remove __counted_by from mxser_board.ports[]

2024-05-30 Thread Jiri Slaby
On 30. 05. 24, 10:33, Jiri Slaby wrote: On 30. 05. 24, 10:12, Gustavo A. R. Silva wrote: On 30/05/24 09:40, Greg Kroah-Hartman wrote: On Thu, May 30, 2024 at 08:22:03AM +0200, Jiri Slaby wrote:   This will be an error in a future compiler version [-Werror,-Wbounds-safety-counted-by-elt-type

Re: [PATCH] tty: mxser: Remove __counted_by from mxser_board.ports[]

2024-06-02 Thread Jiri Slaby
On 30. 05. 24, 10:46, Gustavo A. R. Silva wrote: So we should get rid of all those. Sooner than later. Yes! Please do this. Definitely, we are working on that already[1]. :) FWIW undoing: commit 7391ee16950e772076d321792d9fbf030f921345 Author: Peter Hurley Date: Sat Jun 15 09:36:07 201

Re: [PATCH] lib: string_helpers: fix potential snprintf() output truncation

2024-10-22 Thread Jiri Slaby
On 21. 10. 24, 12:04, Bartosz Golaszewski wrote: From: Bartosz Golaszewski The output of ".%03u" with the unsigned int in range [0, 4294966295] may get truncated if the target buffer is not 12 bytes. Perhaps, if you elaborate on how 'remainder' can become > 999? Fixes: 3c9f3681d0b4 ("[SCSI]

Re: [PATCH][next] tty: tty_buffer: Avoid hundreds of -Wflex-array-member-not-at-end warnings

2025-02-04 Thread Jiri Slaby
On 05. 02. 25, 6:36, Greg Kroah-Hartman wrote: On Wed, Feb 05, 2025 at 03:51:35PM +1030, Gustavo A. R. Silva wrote: -Wflex-array-member-not-at-end was introduced in GCC-14, and we are getting ready to enable it, globally. So, in order to avoid ending up with a flexible-array member in the middl

Re: [PATCH][next] tty: tty_buffer: Avoid hundreds of -Wflex-array-member-not-at-end warnings

2025-02-04 Thread Jiri Slaby
On 05. 02. 25, 7:49, Gustavo A. R. Silva wrote: If the above changes are better for you then I'll send a new patch. :) No, you are supposed to switch tty_buffer to tty_buffer_hdr too. thanks, -- js suse labs

Re: [PATCH v3][next] tty: tty_buffer: Avoid hundreds of -Wflex-array-member-not-at-end warnings

2025-02-06 Thread Jiri Slaby
On 06. 02. 25, 4:39, Gustavo A. R. Silva wrote: Currently, member `sentinel` in `struct tty_bufhead` is causing trouble becase its type is `struct tty_buffer`, which is a flexible structure --meaning it contains a flexible-array member. This combined with the fact that `sentinel` is positioned in