Re: [PATCH][next] xen: privcmd: Replace zero-length array with flex-array member and use __counted_by

2023-11-16 Thread Juergen Gross
On 16.11.23 19:54, Gustavo A. R. Silva wrote: Fake flexible arrays (zero-length and one-element arrays) are deprecated, and should be replaced by flexible-array members. So, replace zero-length array with a flexible-array member in `struct privcmd_kernel_ioreq`. Also annotate array `ports` with

Re: [PATCH] MAINTAINERS: Add netdev subsystem profile link

2023-11-16 Thread patchwork-bot+netdevbpf
Hello: This patch was applied to netdev/net.git (main) by David S. Miller : On Thu, 16 Nov 2023 12:11:51 -0800 you wrote: > The netdev subsystem has had a subsystem process document for a while > now. Link it appropriately in MAINTAINERS with the P: tag. > > Cc: Jakub Kicinski > Cc: "David S. M

Re: [PATCH] SUNRPC: Replace strlcpy() with strscpy()

2023-11-16 Thread NeilBrown
On Wed, 15 Nov 2023, Kees Cook wrote: > strlcpy() reads the entire source buffer first. This read may exceed > the destination size limit. This is both inefficient and can lead > to linear read overflows if a source string is not NUL-terminated[1]. > Additionally, it returns the size of the source

Re: [PATCH][next] xen: privcmd: Replace zero-length array with flex-array member and use __counted_by

2023-11-16 Thread Gustavo A. R. Silva
On 11/16/23 15:08, Kees Cook wrote: On Thu, Nov 16, 2023 at 12:54:59PM -0600, Gustavo A. R. Silva wrote: Fake flexible arrays (zero-length and one-element arrays) are deprecated, and should be replaced by flexible-array members. So, replace zero-length array with a flexible-array member in `s

Re: [PATCH][next] xen: privcmd: Replace zero-length array with flex-array member and use __counted_by

2023-11-16 Thread Kees Cook
On Thu, Nov 16, 2023 at 12:54:59PM -0600, Gustavo A. R. Silva wrote: > Fake flexible arrays (zero-length and one-element arrays) are deprecated, > and should be replaced by flexible-array members. So, replace > zero-length array with a flexible-array member in `struct > privcmd_kernel_ioreq`. > >

Re: [PATCH][next] wifi: mt76: mt7996: Use DECLARE_FLEX_ARRAY() and fix -Warray-bounds warnings

2023-11-16 Thread Kees Cook
On Thu, Nov 16, 2023 at 02:57:24PM -0600, Gustavo A. R. Silva wrote: > Transform zero-length arrays `adm_stat` and `msdu_cnt` into proper > flexible-array members in anonymous union in `struct > mt7996_mcu_all_sta_info_event` via the DECLARE_FLEX_ARRAY() > helper; and fix multiple -Warray-bounds wa

[PATCH][next] wifi: mt76: mt7996: Use DECLARE_FLEX_ARRAY() and fix -Warray-bounds warnings

2023-11-16 Thread Gustavo A. R. Silva
Transform zero-length arrays `adm_stat` and `msdu_cnt` into proper flexible-array members in anonymous union in `struct mt7996_mcu_all_sta_info_event` via the DECLARE_FLEX_ARRAY() helper; and fix multiple -Warray-bounds warnings: drivers/net/wireless/mediatek/mt76/mt7996/mcu.c:483:61: warning: arr

[PATCH] MAINTAINERS: Add netdev subsystem profile link

2023-11-16 Thread Kees Cook
The netdev subsystem has had a subsystem process document for a while now. Link it appropriately in MAINTAINERS with the P: tag. Cc: Jakub Kicinski Cc: "David S. Miller" Cc: Eric Dumazet Cc: Paolo Abeni Cc: net...@vger.kernel.org Signed-off-by: Kees Cook --- MAINTAINERS | 2 ++ 1 file change

[PATCH 0/3] kernfs: Convert from strlcpy() to strscpy()

2023-11-16 Thread Kees Cook
Hi, One of the last users of strlcpy() is kernfs, which has some complex calling hierarchies that needed to be carefully examined. This series refactors the strlcpy() calls into strscpy() calls, and bubbles up all changes in return value checking for callers. -Kees Kees Cook (3): kernfs: Conve

[PATCH 1/3] kernfs: Convert kernfs_walk_ns() from strlcpy() to strscpy()

2023-11-16 Thread Kees Cook
strlcpy() reads the entire source buffer first. This read may exceed the destination size limit. This is both inefficient and can lead to linear read overflows if a source string is not NUL-terminated[1]. Additionally, it returns the size of the source string, not the resulting size of the destinat

[PATCH 3/3] kernfs: Convert kernfs_path_from_node_locked() from strlcpy() to strscpy()

2023-11-16 Thread Kees Cook
One of the last remaining users of strlcpy() in the kernel is kernfs_path_from_node_locked(), which passes back the problematic "length we _would_ have copied" return value to indicate truncation. Convert the chain of all callers to use the negative return value (some of which already doing this e

[PATCH 2/3] kernfs: Convert kernfs_name_locked() from strlcpy() to strscpy()

2023-11-16 Thread Kees Cook
strlcpy() reads the entire source buffer first. This read may exceed the destination size limit. This is both inefficient and can lead to linear read overflows if a source string is not NUL-terminated[1]. Additionally, it returns the size of the source string, not the resulting size of the destinat

[PATCH] samples: Replace strlcpy() with strscpy()

2023-11-16 Thread Kees Cook
strlcpy() reads the entire source buffer first. This read may exceed the destination size limit. This is both inefficient and can lead to linear read overflows if a source string is not NUL-terminated[1]. Additionally, it returns the size of the source string, not the resulting size of the destinat

[PATCH] usb: gadget: f_midi: Replace strlcpy() with strscpy()

2023-11-16 Thread Kees Cook
strlcpy() reads the entire source buffer first. This read may exceed the destination size limit. This is both inefficient and can lead to linear read overflows if a source string is not NUL-terminated[1]. Additionally, it returns the size of the source string, not the resulting size of the destinat

[PATCH] scsi: zfcp: Replace strlcpy() with strscpy()

2023-11-16 Thread Kees Cook
strlcpy() reads the entire source buffer first. This read may exceed the destination size limit. This is both inefficient and can lead to linear read overflows if a source string is not NUL-terminated[1]. Additionally, it returns the size of the source string, not the resulting size of the destinat

[PATCH] parisc: Replace strlcpy() with strscpy()

2023-11-16 Thread Kees Cook
strlcpy() reads the entire source buffer first. This read may exceed the destination size limit. This is both inefficient and can lead to linear read overflows if a source string is not NUL-terminated[1]. Additionally, it returns the size of the source string, not the resulting size of the destinat

[PATCH][next] xen: privcmd: Replace zero-length array with flex-array member and use __counted_by

2023-11-16 Thread Gustavo A. R. Silva
Fake flexible arrays (zero-length and one-element arrays) are deprecated, and should be replaced by flexible-array members. So, replace zero-length array with a flexible-array member in `struct privcmd_kernel_ioreq`. Also annotate array `ports` with `__counted_by()` to prepare for the coming imple

Re: [PATCH] qnx4: fix to avoid panic due to buffer overflow

2023-11-16 Thread Kees Cook
On Thu, Nov 16, 2023 at 05:48:20PM +0100, Anders Larsen wrote: > On 2023-11-16 15:58 Kees Cook wrote: > > if ((de->di_status & QNX4_FILE_LINK) == QNX4_FILE_LINK) { > > lnk = (struct qnx4_link_info *) de; > > > > It seems that entries may be either struct qnx4_inode_entry or

Re: [PATCH] qnx4: fix to avoid panic due to buffer overflow

2023-11-16 Thread Anders Larsen
On 2023-11-16 15:58 Kees Cook wrote: > On Thu, Nov 16, 2023 at 06:29:59AM -0800, Kees Cook wrote: > > On Sun, Nov 12, 2023 at 07:53:53PM +1000, Ronald Monthero wrote: > > > qnx4 dir name length can vary to be of maximum size > > > QNX4_NAME_MAX or QNX4_SHORT_NAME_MAX depending on whether > > > 'lin

Re: [PATCH] qnx4: fix to avoid panic due to buffer overflow

2023-11-16 Thread Kees Cook
On Thu, Nov 16, 2023 at 06:29:59AM -0800, Kees Cook wrote: > On Sun, Nov 12, 2023 at 07:53:53PM +1000, Ronald Monthero wrote: > > qnx4 dir name length can vary to be of maximum size > > QNX4_NAME_MAX or QNX4_SHORT_NAME_MAX depending on whether > > 'link info' entry is stored and the status byte is

Re: [PATCH] qnx4: fix to avoid panic due to buffer overflow

2023-11-16 Thread Kees Cook
On Sun, Nov 12, 2023 at 07:53:53PM +1000, Ronald Monthero wrote: > qnx4 dir name length can vary to be of maximum size > QNX4_NAME_MAX or QNX4_SHORT_NAME_MAX depending on whether > 'link info' entry is stored and the status byte is set. > So to avoid buffer overflow check di_fname length > fetched

Re: [PATCH][next] Makefile: Enable -Wstringop-overflow globally

2023-11-16 Thread Gustavo A. R. Silva
On 11/16/23 05:23, Masahiro Yamada wrote: On Thu, Nov 16, 2023 at 12:27 PM Gustavo A. R. Silva wrote: It seems that we have finished addressing all the remaining issues regarding compiler option -Wstringop-overflow. So, we are now in good shape to enable this compiler option globally. Sign

[PATCH] hwmon: Explicitly initialize nct6775_sio_names indexes

2023-11-16 Thread Kees Cook
Changing the "kinds" enum start value to be 1-indexed instead of 0-indexed caused look-ups in nct6775_sio_namesp[] to be misaligned or off the end. Coverity reported: *** CID 1571052: Memory - illegal accesses (OVERRUN) drivers/hwmon/nct6775-platform.c:1075 in nct6775_find() 1069

Re: [PATCH][next] Makefile: Enable -Wstringop-overflow globally

2023-11-16 Thread Masahiro Yamada
On Thu, Nov 16, 2023 at 12:27 PM Gustavo A. R. Silva wrote: > > It seems that we have finished addressing all the remaining > issues regarding compiler option -Wstringop-overflow. So, we > are now in good shape to enable this compiler option globally. > > Signed-off-by: Gustavo A. R. Silva > ---