Re: [PATCH v2][next] net: atlantic: Avoid -Wflex-array-member-not-at-end warnings

2025-02-04 Thread Simon Horman
rnel.org/linux-hardening/ZrDwoVKH8d6TdVxn@cute/ Reviewed-by: Simon Horman

Re: [PATCH] net: core: Convert inet_addr_is_any() to sockaddr_storage

2024-12-17 Thread Simon Horman
; > Signed-off-by: Kees Cook Reviewed-by: Simon Horman

Re: [PATCH] caif: replace deprecated strncpy with strscpy_pad

2024-09-13 Thread Simon Horman
On Thu, Sep 12, 2024 at 01:47:22PM -0700, Justin Stitt wrote: > On Thu, Sep 12, 2024 at 1:43 PM Justin Stitt wrote: > > > > Hi, > > > > On Tue, Sep 10, 2024 at 2:37 AM Simon Horman wrote: > > > > > > On Mon, Sep 09, 2024 at 04:39:28PM -0700, Justin

Re: [PATCH] caif: replace deprecated strncpy with strscpy_pad

2024-09-10 Thread Simon Horman
On Mon, Sep 09, 2024 at 04:39:28PM -0700, Justin Stitt wrote: > strncpy() is deprecated for use on NUL-terminated destination strings [1] and > as such we should prefer more robust and less ambiguous string interfaces. > > Towards the goal of [2], replace strncpy() with an alternative that > guara

Re: [PATCH][next] nfc: pn533: Avoid -Wflex-array-member-not-at-end warnings

2024-08-20 Thread Simon Horman
structure > [-Wflex-array-member-not-at-end] > > Signed-off-by: Gustavo A. R. Silva Reviewed-by: Simon Horman

Re: [PATCH][next] nfp: Use static_assert() to check struct sizes

2024-08-12 Thread Simon Horman
cture, they are always included within this tagged struct. > > So, we use `static_assert()` to ensure that the memory layout for > both the flexible structure and the tagged struct is the same after > any changes. > > Signed-off-by: Gustavo A. R. Silva Reviewed-by: Simon Horman

Re: [PATCH][next] wifi: radiotap: Avoid -Wflex-array-member-not-at-end warnings

2024-08-08 Thread Simon Horman
ure > [-Wflex-array-member-not-at-end] > drivers/net/wireless/virtual/mac80211_hwsim.c:767:42: warning: structure > containing a flexible array member is not at the end of another structure > [-Wflex-array-member-not-at-end] > > Signed-off-by: Gustavo A. R. Silva Reviewed-by: Simon Horman

Re: [PATCH][next] cxgb4: Avoid -Wflex-array-member-not-at-end warning

2024-08-07 Thread Simon Horman
45:27: warning: > structure containing a flexible array member is not at the end of another > structure [-Wflex-array-member-not-at-end] > > Signed-off-by: Gustavo A. R. Silva Reviewed-by: Simon Horman

Re: [PATCH][next] ethtool: Avoid -Wflex-array-member-not-at-end warning

2024-08-07 Thread Simon Horman
On Wed, Aug 07, 2024 at 05:26:02PM +0100, Simon Horman wrote: > On Mon, Aug 05, 2024 at 09:38:08AM -0600, 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. > > > > Move the con

Re: [PATCH][next] ethtool: Avoid -Wflex-array-member-not-at-end warning

2024-08-07 Thread Simon Horman
ember-not-at-end] > > Signed-off-by: Gustavo A. R. Silva Reviewed-by: Simon Horman

Re: [PATCH][next] sched: act_ct: avoid -Wflex-array-member-not-at-end warning

2024-08-07 Thread Simon Horman
; Signed-off-by: Gustavo A. R. Silva Reviewed-by: Simon Horman

Re: [PATCH v2] net/ipv4/tcp_cong: Replace strncpy() with strscpy()

2024-07-15 Thread Simon Horman
itly target the patch against net-next. Subject: [PATCH net-next v2] tcp: ... That notwithstanding, this looks good to me. Reviewed-by: Simon Horman ...

Re: [PATCH net-next v3] netdevice: define and allocate &net_device _properly_

2024-07-10 Thread Simon Horman
On Wed, Jul 10, 2024 at 04:30:28AM -0700, Breno Leitao wrote: > From: Alexander Lobakin > > In fact, this structure contains a flexible array at the end, but > historically its size, alignment etc., is calculated manually. > There are several instances of the structure embedded into other > struc

Re: [PATCH net-next v2] netdevice: define and allocate &net_device _properly_

2024-07-10 Thread Simon Horman
On Tue, Jul 09, 2024 at 01:19:44PM -0700, Breno Leitao wrote: > On Tue, Jul 09, 2024 at 07:11:28PM +0100, Simon Horman wrote: > > On Tue, Jul 09, 2024 at 05:54:25AM -0700, Breno Leitao wrote: > > > From: Alexander Lobakin > > > > > > In fact, this structure

Re: [PATCH net-next v2] netdevice: define and allocate &net_device _properly_

2024-07-09 Thread Simon Horman
On Tue, Jul 09, 2024 at 05:54:25AM -0700, Breno Leitao wrote: > From: Alexander Lobakin > > In fact, this structure contains a flexible array at the end, but > historically its size, alignment etc., is calculated manually. > There are several instances of the structure embedded into other > struc

Re: [RFC PATCH v2] ptp: Add vDSO-style vmclock support

2024-06-30 Thread Simon Horman
+ Kees Cook, linux-hardening On Tue, Jun 25, 2024 at 08:01:56PM +0100, David Woodhouse wrote: > From: David Woodhouse > > The vmclock "device" provides a shared memory region with precision clock > information. By using shared memory, it is safe across Live Migration. > > Like the KVM PTP clock

Re: [PATCH net-next v3] net: mana: Allow variable size indirection table

2024-06-06 Thread Simon Horman
On Wed, Jun 05, 2024 at 01:39:06AM -0700, Shradha Gupta wrote: > On Tue, Jun 04, 2024 at 10:33:49AM +0100, Simon Horman wrote: > > On Fri, May 31, 2024 at 08:37:41AM -0700, Shradha Gupta wrote: > > > Allow variable size indirection table allocation in MANA instead > > >

Re: [PATCH v4 4/6] mm/slab: Introduce kmem_buckets_create() and family

2024-06-05 Thread Simon Horman
On Tue, Jun 04, 2024 at 05:49:20PM -0700, Kees Cook wrote: > On Tue, Jun 04, 2024 at 04:13:32PM -0600, Tycho Andersen wrote: > > On Tue, Jun 04, 2024 at 04:02:28PM +0100, Simon Horman wrote: > > > On Fri, May 31, 2024 at 12:14:56PM -0700, Kees Cook wrote: > > >

Re: [PATCH v4 4/6] mm/slab: Introduce kmem_buckets_create() and family

2024-06-04 Thread Simon Horman
On Fri, May 31, 2024 at 12:14:56PM -0700, Kees Cook wrote: ... > diff --git a/mm/slab_common.c b/mm/slab_common.c > index b5c879fa66bc..f42a98d368a9 100644 > --- a/mm/slab_common.c > +++ b/mm/slab_common.c > @@ -392,6 +392,82 @@ kmem_cache_create(const char *name, unsigned int size, > unsigned i

Re: [PATCH net-next v3] net: mana: Allow variable size indirection table

2024-06-04 Thread Simon Horman
On Fri, May 31, 2024 at 08:37:41AM -0700, Shradha Gupta wrote: > Allow variable size indirection table allocation in MANA instead > of using a constant value MANA_INDIRECT_TABLE_SIZE. > The size is now derived from the MANA_QUERY_VPORT_CONFIG and the > indirection table is allocated dynamically. >

Re: [PATCH v2] wifi: mac80211: Avoid address calculations via out of bounds array indexing

2024-05-31 Thread Simon Horman
On Thu, May 23, 2024 at 11:35:37AM +0200, Johannes Berg wrote: > On Fri, 2024-05-17 at 21:45 +0100, Simon Horman wrote: > > > > FWWIW, it seems unfortunate to me that the __counted_by field (n_channels) > > is set some distance away from the allocation of the flex-array

Re: [PATCH v2] wifi: mac80211: Avoid address calculations via out of bounds array indexing

2024-05-17 Thread Simon Horman
FWWIW, it seems unfortunate to me that the __counted_by field (n_channels) is set some distance away from the allocation of the flex-array (channels) whose bounds it checks. It seems it would be pretty easy for a bug in the code being updated here to result in an overrun. But in any case, I think this is an improvement and seems correct to me. Reviewed-by: Simon Horman

Re: [PATCH] net: prestera: Add flex arrays to some structs

2024-05-13 Thread Simon Horman
ccinelle, and audited and > modified manually. > > Link: > https://www.kernel.org/doc/html/next/process/deprecated.html#zero-length-and-one-element-arrays > [1] > Link: > https://www.kernel.org/doc/html/next/process/deprecated.html#open-coded-arithmetic-in-allocator-arguments > [2] > Signed-off-by: Erick Archer Reviewed-by: Simon Horman

[PATCH net-next v2 2/2] gve: Use ethtool_sprintf/puts() to fill stats strings

2024-05-08 Thread Simon Horman
e_gstrings_adminq_stats' too small (32 vs 512) Compile tested only. Reviewed-by: Shailend Chand Reviewed-by: Larysa Zaremba Signed-off-by: Simon Horman --- drivers/net/ethernet/google/gve/gve_ethtool.c | 42 +++ 1 file changed, 17 insertions(+), 25 deletions(-) d

[PATCH net-next v2 1/2] gve: Avoid unnecessary use of comma operator

2024-05-08 Thread Simon Horman
Although it does not seem to have any untoward side-effects, the use of ';' to separate to assignments seems more appropriate than ','. Flagged by clang-18 -Wcomma No functional change intended. Compile tested only. Reviewed-by: Shailend Chand Reviewed-by: Larysa Zaremba

[PATCH net-next v2 0/2] gve: Minor cleanups

2024-05-08 Thread Simon Horman
! - Rebased - Link to v1: https://lore.kernel.org/r/20240503-gve-comma-v1-0-b50f96569...@kernel.org --- Simon Horman (2): gve: Avoid unnecessary use of comma operator gve: Use ethtool_sprintf/puts() to fill stats strings drivers/net/ethernet/google/gve/gve_adminq.c | 4 +-- drivers

Re: [PATCH net-next 0/2] gve: Minor cleanups

2024-05-08 Thread Simon Horman
On Tue, May 07, 2024 at 03:28:46PM -0700, Jakub Kicinski wrote: > On Fri, 03 May 2024 21:31:25 +0100 Simon Horman wrote: > > This short patchset provides two minor cleanups for the gve driver. > > > > These were found by tooling as mentioned in each patch, > >

[PATCH net-next 2/2] gve: Use ethtool_sprintf/puts() to fill stats strings

2024-05-03 Thread Simon Horman
e_gstrings_adminq_stats' too small (32 vs 512) Compile tested only. Signed-off-by: Simon Horman --- drivers/net/ethernet/google/gve/gve_ethtool.c | 42 +++ 1 file changed, 17 insertions(+), 25 deletions(-) diff --git a/drivers/net/ethernet/google/gve/gve_etht

[PATCH net-next 1/2] gve: Avoid unnecessary use of comma operator

2024-05-03 Thread Simon Horman
Although it does not seem to have any untoward side-effects, the use of ';' to separate to assignments seems more appropriate than ','. Flagged by clang-18 -Wcomma No functional change intended. Compile tested only. Signed-off-by: Simon Horman --- drivers/net/ethernet/goo

[PATCH net-next 0/2] gve: Minor cleanups

2024-05-03 Thread Simon Horman
Hi, This short patchset provides two minor cleanups for the gve driver. These were found by tooling as mentioned in each patch, and otherwise by inspection. No change in run time behaviour is intended. Each patch is compile tested only. --- Simon Horman (2): gve: Avoid unnecessary use of

Re: [PATCH RFC kspp-next 3/3] idpf: sprinkle __counted_by{,_le}() in the virtchnl2 header

2024-03-19 Thread Simon Horman
On Mon, Mar 18, 2024 at 02:03:54PM +0100, Alexander Lobakin wrote: > Both virtchnl2.h and its consumer idpf_virtchnl.c are very error-prone. > There are 10 structures with flexible arrays at the end, but 9 of them > has flex member counter in Little Endian. > Make the code a bit more robust by appl

Re: [PATCH v2] overflow: Change DEFINE_FLEX to take __counted_by member

2024-03-11 Thread Simon Horman
On Sat, Mar 09, 2024 at 12:32:45PM -0800, Kees Cook wrote: > On Fri, Mar 08, 2024 at 08:20:18PM +0000, Simon Horman wrote: > > On Wed, Mar 06, 2024 at 03:51:36PM -0800, Kees Cook wrote: > > > The norm should be flexible array structures with __counted_by > > > annot

Re: [PATCH v2] overflow: Change DEFINE_FLEX to take __counted_by member

2024-03-08 Thread Simon Horman
On Wed, Mar 06, 2024 at 03:51:36PM -0800, Kees Cook wrote: > The norm should be flexible array structures with __counted_by > annotations, so DEFINE_FLEX() is updated to expect that. Rename > the non-annotated version to DEFINE_RAW_FLEX(), and update the > few existing users. > > Signed-off-by: Ke

Re: [PATCH v3] sock: Use unsafe_memcpy() for sock_copy()

2024-03-05 Thread Simon Horman
rnel.org > v3: fix inet_reqsk_clone() comment > v2: https://lore.kernel.org/lkml/20240216232220.it.450-k...@kernel.org > v1: https://lore.kernel.org/lkml/20240216204423.work.066-k...@kernel.org Reviewed-by: Simon Horman

Re: [PATCH] netfilter: x_tables: Use unsafe_memcpy() for 0-sized destination

2024-02-19 Thread Simon Horman
> 0-sized destinations in memcpy(), an exception must be made for the one > place where it is still a destination. Since memcpy() was already > skipping checks for 0-sized destinations, using unsafe_memcpy() is no > change in behavior. > > Signed-off-by: Kees Cook Reviewed-by: Simon Horman

Re: [PATCH bpf-next] bpf: Check return from set_memory_rox() and friends

2024-02-19 Thread Simon Horman
On Sat, Feb 17, 2024 at 11:24:07AM +0100, Christophe Leroy wrote: > arch_protect_bpf_trampoline() and alloc_new_pack() call > set_memory_rox() which can fail, leading to unprotected memory. > > Take into account return from set_memory_XX() functions and add > __must_check flag to arch_protect_bpf_

Re: [PATCH] net/sun3_82586: Avoid reading past buffer in debug output

2024-02-08 Thread Simon Horman
t; > Cc: Eric Dumazet > Cc: Jakub Kicinski > Cc: Paolo Abeni > Cc: Gustavo A. R. Silva > Cc: net...@vger.kernel.org > Signed-off-by: Kees Cook Reviewed-by: Simon Horman Tested-by: Simon Horman # build-tested ...

Re: [ovs-dev] [PATCH v2 2/2] net: openvswitch: Annotate struct mask_array with __counted_by

2023-10-17 Thread Simon Horman
w_table.h > > @@ -48,7 +48,7 @@ struct mask_array { > > int count, max; > > struct mask_array_stats __percpu *masks_usage_stats; > > u64 *masks_usage_zero_cntr; > > - struct sw_flow_mask __rcu *masks[]; > > + struct sw_flow_mask __rcu *masks[] __counted_by(max); > > }; > > Yup, this looks correct to me. Thanks! > > Reviewed-by: Kees Cook > Likewise, I agree this is correct. Reviewed-by: Simon Horman

Re: [PATCH] net: phy: smsc: replace deprecated strncpy with ethtool_sprintf

2023-10-15 Thread Simon Horman
> [2] > Link: https://github.com/KSPP/linux/issues/90 > Cc: linux-hardening@vger.kernel.org > Signed-off-by: Justin Stitt > --- > Note: build-tested only. > > Found with: $ rg "strncpy\(" I agree that this is functionally equivalent. Reviewed-by: Simon Horman

Re: [PATCH] qed/red_ll2: Fix undefined behavior bug in struct qed_ll2_info

2023-09-28 Thread Simon Horman
a > one-element array, and started to be used as a Variable Length Object > (VLO) at run-time. > > Fixes: f5823fe6897c ("qed: Add ll2 option to limit the number of bds per > packet") > Cc: sta...@vger.kernel.org > Signed-off-by: Gustavo A. R. Silva Reviewed-by: Simon Horman