Re: [PATCH] wireguard: noise: Add __nonstring annotations for unterminated strings

2025-03-11 Thread Jakub Kicinski
On Mon, 10 Mar 2025 15:22:50 -0700 Kees Cook wrote: > When a character array without a terminating NUL character has a static > initializer, GCC 15's -Wunterminated-string-initialization will only > warn if the array lacks the "nonstring" attribute[1]. Mark the arrays > with __nonstring to and corr

Re: [PATCH v3][next] net/mlx5e: Avoid a hundred -Wflex-array-member-not-at-end warnings

2025-02-26 Thread Jakub Kicinski
On Wed, 26 Feb 2025 10:49:35 -0800 Saeed Mahameed wrote: > On 26 Feb 13:47, Gustavo A. R. Silva wrote: > >-struct mlx5e_umr_wqe { > >+struct mlx5e_umr_wqe_hdr { > > struct mlx5_wqe_ctrl_seg ctrl; > > struct mlx5_wqe_umr_ctrl_seg uctrl; > > struct mlx5_mkey_seg mkc; > >

Re: [PATCH][next] net/mlx5e: Avoid a hundred -Wflex-array-member-not-at-end warnings

2025-02-20 Thread Jakub Kicinski
On Thu, 6 Feb 2025 15:07:07 +1030 Gustavo A. R. Silva wrote:> > Here is another alternative for this. And similarly to the > struct_group_tagged() > change above, no struct members should be added before or after `struct > mlx5e_umr_wqe_hdr hdr;` in `struct mlx5e_umr_wqe`: Gustavo, could you su

Re: [PATCH][next] net/mlx5e: Avoid a hundred -Wflex-array-member-not-at-end warnings

2025-02-19 Thread Jakub Kicinski
On Wed, 19 Feb 2025 14:14:35 +0200 Tariq Toukan wrote: > On 18/02/2025 23:13, Jakub Kicinski wrote: > > On Tue, 18 Feb 2025 17:53:14 +0200 Tariq Toukan wrote: > >> Maybe it wasn't clear enough. > >> We prefer the original patch, and provided the Reviewed-by tag fo

Re: [PATCH net-next v3 1/2] ip_tunnel: Use ip_tunnel_info() helper instead of 'info + 1'

2025-02-18 Thread Jakub Kicinski
On Mon, 17 Feb 2025 22:25:02 +0200 Gal Pressman wrote: > diff --git a/net/sched/act_tunnel_key.c b/net/sched/act_tunnel_key.c > index af7c99845948..6d97be6bc7fa 100644 > --- a/net/sched/act_tunnel_key.c > +++ b/net/sched/act_tunnel_key.c > @@ -572,7 +572,7 @@ static int tunnel_key_geneve_opts_dump(

Re: [PATCH][next] net/mlx5e: Avoid a hundred -Wflex-array-member-not-at-end warnings

2025-02-18 Thread Jakub Kicinski
On Tue, 18 Feb 2025 17:53:14 +0200 Tariq Toukan wrote: > Maybe it wasn't clear enough. > We prefer the original patch, and provided the Reviewed-by tag for it. Can you explain what do you mean by "cleaner"? I like the alternative much more.

Re: [PATCH net-next v2] net: Add options as a flexible array to struct ip_tunnel_info

2025-02-12 Thread Jakub Kicinski
On Wed, 12 Feb 2025 20:13:28 +0200 Gal Pressman wrote: > > You could leave this macro inplace and just change `(info) + 1` to > > `(info)->options` avoiding changes in lots of files and adding casts > > everywhere. +1 > I'd rather not, having a macro to do 'info->options' doesn't help code > re

Re: [PATCH net-next] net: Add options as a flexible array to struct ip_tunnel_info

2025-02-11 Thread Jakub Kicinski
On Tue, 11 Feb 2025 20:59:24 +0200 Gal Pressman wrote: > > Everything else looks very good, though, yes, I would agree with the > > alignment comments made down-thread. This was "accidentally correct" > > before in the sense that the end of the struct would be padded for > > alignment, but isn't gu

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

2025-01-16 Thread Jakub Kicinski
On Thu, 16 Jan 2025 13:39:52 -0800 Roman Kisel wrote: > On 1/16/2025 1:19 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. > > > > Use struct_size_t(,,1) instead of sizeof() to m

Re: [PATCH v2 1/2][next] UAPI: ethtool: Use __struct_group() in struct ethtool_link_settings

2024-12-09 Thread Jakub Kicinski
On Mon, 9 Dec 2024 12:59:40 -0800 Christopher Ferris wrote: > It looks like the way this was fixed in the ethtool.h uapi header was to > revert the usage of __struct_group. Should something similar happen for > pkt_cls.h? Or would it be easier to simply remove the usage of the TAG in > the _struct_

Re: [PATCH 3/3] UAPI: ethtool: Avoid flex-array in struct ethtool_link_settings

2024-11-15 Thread Jakub Kicinski
htool CLI doesn't but looks like NetworkManager does. So as you say we'll cross that bridge... Reviewed-by: Jakub Kicinski Thanks!

Re: [PATCH RFC][next] net: inet_sock.h: Avoid thousands of -Wflex-array-member-not-at-end warnings

2024-11-11 Thread Jakub Kicinski
On Mon, 11 Nov 2024 20:34:07 -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 RFC is fine, but please don't post anything intended for merging until we have clarity on the C++ vs uAPI headers issue.

Re: [PATCH v2 1/2][next] UAPI: ethtool: Use __struct_group() in struct ethtool_link_settings

2024-11-09 Thread Jakub Kicinski
On Sat, 9 Nov 2024 10:02:13 -0800 Jakub Kicinski wrote: > $ g++ /tmp/t.cpp -I../linux -o /dev/null -c -W -Wall -O2 gcc version 14.2.1 20240912 (Red Hat 14.2.1-3) (GCC)

Re: [PATCH v2 1/2][next] UAPI: ethtool: Use __struct_group() in struct ethtool_link_settings

2024-11-09 Thread Jakub Kicinski
On Tue, 29 Oct 2024 15:55:35 -0600 Gustavo A. R. Silva wrote: > Use the `__struct_group()` helper to create a new tagged > `struct ethtool_link_settings_hdr`. This structure groups together > all the members of the flexible `struct ethtool_link_settings` > except the flexible array. As a result, th

Re: [PATCH RFC 0/5] sockaddr usage removal

2024-11-05 Thread Jakub Kicinski
On Mon, 4 Nov 2024 14:25:02 -0800 Kees Cook wrote: > I think for getname() (and similar interfaces) we *do* want to use > sockaddr_storage, but there is kind of an argument to instead use > a struct with a flexible array, e.g.: > > struct sockaddr_unspec { > sa_family_t sa_family; >

Re: [PATCH v2 1/4][next] uapi: socket: Introduce struct sockaddr_legacy

2024-10-31 Thread Jakub Kicinski
On Thu, 24 Oct 2024 15:11:24 -0600 Gustavo A. R. Silva wrote: > + * This is the legacy form of `struct sockaddr`. The original `struct > sockaddr` > + * was modified in commit b5f0de6df6dce ("net: dev: Convert sa_data to > flexible > + * array in struct sockaddr") due to the fact that "One of the

Re: [PATCH 2/2][next] net: ethtool: Avoid thousands of -Wflex-array-member-not-at-end warnings

2024-10-29 Thread Jakub Kicinski
On Tue, 29 Oct 2024 13:18:56 -0600 Gustavo A. R. Silva wrote: > By priority I mean if preserving the reverse xmas tree is a most > after any changes that mess in some way with it. As in the case below, > where things were already messed up: > > + const struct ethtool_link_settings_hdr *base

Re: [PATCH 2/2][next] net: ethtool: Avoid thousands of -Wflex-array-member-not-at-end warnings

2024-10-29 Thread Jakub Kicinski
On Tue, 29 Oct 2024 12:48:32 -0600 Gustavo A. R. Silva wrote: > >> Is this going to be a priority for any other netdev patches in the future? > >> > > > > It's been the preferred formatting for a decade or more. > > Which is why the net/ethtool/ code you're touching follows > > this convention.

Re: [PATCH 2/2][next] net: ethtool: Avoid thousands of -Wflex-array-member-not-at-end warnings

2024-10-29 Thread Jakub Kicinski
On Tue, 29 Oct 2024 12:18:56 -0600 Gustavo A. R. Silva wrote: > >> I don't think you want to change this. `lsettings` is based on > >> `ksettings`. So, > >> `ksettings` should go first. The same scenario for the one below. > > > > In which case you need to move the init out of line. > > So,

Re: [PATCH 2/2][next] net: ethtool: Avoid thousands of -Wflex-array-member-not-at-end warnings

2024-10-29 Thread Jakub Kicinski
On Tue, 29 Oct 2024 10:55:14 -0600 Gustavo A. R. Silva wrote: > On 29/10/24 07:58, Jakub Kicinski wrote: > > On Mon, 21 Oct 2024 13:02:27 -0600 Gustavo A. R. Silva wrote: > >> @@ -3025,7 +3025,7 @@ static int bnxt_set_link_ksettings(struct net_device > >> *dev, >

Re: [PATCH 2/2][next] net: ethtool: Avoid thousands of -Wflex-array-member-not-at-end warnings

2024-10-29 Thread Jakub Kicinski
On Mon, 21 Oct 2024 13:02:27 -0600 Gustavo A. R. Silva wrote: > @@ -3025,7 +3025,7 @@ static int bnxt_set_link_ksettings(struct net_device > *dev, > { > struct bnxt *bp = netdev_priv(dev); > struct bnxt_link_info *link_info = &bp->link_info; > - const struct ethtool_link_settings

Re: [PATCH 2/2][next] net: ethtool: Avoid thousands of -Wflex-array-member-not-at-end warnings

2024-10-29 Thread Jakub Kicinski
On Mon, 28 Oct 2024 20:37:13 -0600 Gustavo A. R. Silva wrote: > The rest will essentially remain the same as the change in > include/linux/ethtool.h triggers a cascade of changes across > the rest of the files in this patch. > > So, you tell me if you still want me to split this patch. In any case

Re: [PATCH 2/2][next] net: ethtool: Avoid thousands of -Wflex-array-member-not-at-end warnings

2024-10-28 Thread Jakub Kicinski
On Mon, 28 Oct 2024 17:32:53 -0600 Gustavo A. R. Silva wrote: > >> Additionally, update the type of some variables in various functions > >> that don't access the flexible-array member, changing them to the > >> newly created `struct ethtool_link_settings_hdr`. > > > > Why? Please avoid unnecess

Re: [PATCH 2/2][next] net: ethtool: Avoid thousands of -Wflex-array-member-not-at-end warnings

2024-10-28 Thread Jakub Kicinski
On Mon, 21 Oct 2024 13:02:27 -0600 Gustavo A. R. Silva wrote: > Fix 3338 of the following -Wflex-array-member-not-at-end warnings: > > include/linux/ethtool.h:214:38: warning: structure containing a flexible > array member is not at the end of another structure > [-Wflex-array-member-not-at-end]

Re: [PATCH -next 2/4] tun: Make use of str_disabled_enabled helper

2024-09-04 Thread Jakub Kicinski
On Wed, 4 Sep 2024 10:27:18 +0800 Hongbo Li wrote: > However, with these modifications, I'm not sure whether Willem and Jakub > agree with the changes. If they don't agree, then I'll have to remove > this example in the next version. This and, to be clear, patch 4 as well. > In the future, we c

Re: [PATCH -next 2/4] tun: Make use of str_disabled_enabled helper

2024-09-02 Thread Jakub Kicinski
On Mon, 2 Sep 2024 09:10:33 +0300 Gal Pressman wrote: > > You don't explain the 'why'. How is this an improvement? > > nack on this and 2 similar networking changes you sent > > Are you against the concept of string_choices in general, or this > specific change? Willem verbalized my opinion bette

Re: [PATCH -next 2/4] tun: Make use of str_disabled_enabled helper

2024-08-31 Thread Jakub Kicinski
On Sat, 31 Aug 2024 17:58:38 +0800 Hongbo Li wrote: > Use str_disabled_enabled() helper instead of open > coding the same. > diff --git a/drivers/net/tun.c b/drivers/net/tun.c > index 6fe5e8f7017c..29647704bda8 100644 > --- a/drivers/net/tun.c > +++ b/drivers/net/tun.c > @@ -3178,7 +3178,7 @@ stat

Re: [PATCH v2][next] UAPI: net/sched: Avoid -Wflex-array-member-not-at-end warning

2024-08-12 Thread Jakub Kicinski
On Fri, 9 Aug 2024 09:42:03 -0700 Stephen Hemminger wrote: > Tested this with iproute2-next and clang and no problem. > > The patch might be better split into two parts? Fair point, a small two-patch series would be ideal. -- pw-bot: cr

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

2024-08-08 Thread Jakub Kicinski
On Mon, 5 Aug 2024 09:35:46 -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 conflicting declaration to the end of the structure. Notice > that `struct zones_ht_key` is a flexible structure -

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

2024-08-08 Thread Jakub Kicinski
On Thu, 8 Aug 2024 12:41:32 -0600 Gustavo A. R. Silva wrote: > >> .../chelsio/cxgb4/cxgb4_tc_u32_parse.h| 2 +- > >> include/uapi/linux/pkt_cls.h | 23 +++ > > > > Took me a minute to realize you're changing uAPI. > > Please fix the subject. > > Wha

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

2024-08-07 Thread Jakub Kicinski
On Mon, 5 Aug 2024 10:24:30 -0600 Gustavo A. R. Silva wrote: > Subject: [PATCH][next] cxgb4: Avoid -Wflex-array-member-not-at-end warning > Date: Mon, 5 Aug 2024 10:24:30 -0600 > .../chelsio/cxgb4/cxgb4_tc_u32_parse.h| 2 +- > include/uapi/linux/pkt_cls.h | 23 ++

Re: [PATCH v2] net: core: annotate socks of struct sock_reuseport with __counted_by

2024-07-31 Thread Jakub Kicinski
On Wed, 31 Jul 2024 07:53:46 +0300 Dmitry Antipov wrote: > + reuse = kzalloc(struct_size(reuse, socks, max_socks), GFP_ATOMIC); > > if (!reuse) another nit -- no empty lines between function call and its error check :) Two bits of docs to look at before sending v3: https://www.kernel.

Re: [PATCH] net: core: use __counted_by for trailing VLA of struct sock_reuseport

2024-07-30 Thread Jakub Kicinski
On Tue, 30 Jul 2024 19:04:49 +0300 Dmitry Antipov wrote: > - unsigned int size = sizeof(struct sock_reuseport) + > - sizeof(struct sock *) * max_socks; > - struct sock_reuseport *reuse = kzalloc(size, GFP_ATOMIC); > + struct sock_reuseport *reuse = > + kzal

Re: [PATCH] ethernet: sis900: use sizeof(*pointer) instead of sizeof(type)

2024-06-12 Thread Jakub Kicinski
On Sat, 8 Jun 2024 12:20:33 +0200 Erick Archer wrote: > It is preferred to use sizeof(*pointer) instead of sizeof(type) > due to the type of the variable can change and one needs not > change the former (unlike the latter). > > At the same time remove some unnecessary initializations and > refact

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

2024-05-30 Thread Jakub Kicinski
On Thu, 30 May 2024 17:37:02 +0300 Leon Romanovsky wrote: > Once you are ok with this patch, let me create shared branch for it. > It is -rc1 and Konstantin already submitted some changes to qp.c > https://lore.kernel.org/all/1716366242-558-1-git-send-email-kotara...@linux.microsoft.com/ > > This

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

2024-05-30 Thread Jakub Kicinski
On Tue, 28 May 2024 22:35:55 -0700 Shradha Gupta wrote: > + save_table = kcalloc(apc->indir_table_sz, sizeof(u32), GFP_KERNEL); > + if (!save_table) > + return -ENOMEM; > + > if (rxfh->indir) { > - for (i = 0; i < MANA_INDIRECT_TABLE_SIZE; i++) > +

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

2024-05-23 Thread Jakub Kicinski
On Thu, 23 May 2024 09:55:14 -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. > > Sign

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

2024-05-07 Thread Jakub Kicinski
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, > and otherwise by inspection. > > No change in run time behaviour is intended. > Each patch is compile tested o

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

2024-05-07 Thread Jakub Kicinski
On Tue, 7 May 2024 14:39:37 +0200 Alexander Lobakin wrote: > There are several instances of the structure embedded into other > structures, but also there's ongoing effort to remove them and we > could in the meantime declare &net_device properly. Is there a reason you're reposting this before th

Re: [PATCH v3 0/3] RDMA/mana_ib: Add flex array to struct mana_cfg_rx_steer_req_v2

2024-04-11 Thread Jakub Kicinski
On Thu, 11 Apr 2024 13:58:39 +0300 Leon Romanovsky wrote: > I prepared mana-ib-flex branch > https://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma.git/log/?h=mana-ib-flex > and merge ti to our wip branch > https://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma.git/commit/?h=wip/leon-for-ne

Re: [PATCH v3 0/3] RDMA/mana_ib: Add flex array to struct mana_cfg_rx_steer_req_v2

2024-04-09 Thread Jakub Kicinski
On Tue, 9 Apr 2024 18:01:40 +0100 Edward Cree wrote: > > Shared branch would be good. Ed has some outstanding patches > > to refactor the ethtool RSS API. > > For the record I am extremely unlikely to have time to get those > done this cycle :( > Though in any case fwiw it doesn't look like th

Re: [PATCH v3 0/3] RDMA/mana_ib: Add flex array to struct mana_cfg_rx_steer_req_v2

2024-04-08 Thread Jakub Kicinski
On Mon, 8 Apr 2024 14:07:30 +0300 Leon Romanovsky wrote: > Jakub, do you want shared branch for this series or should I take > everything through RDMA tree as netdev part is small enough? Shared branch would be good. Ed has some outstanding patches to refactor the ethtool RSS API.

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

2024-04-01 Thread Jakub Kicinski
On Thu, 28 Mar 2024 19:17:10 -0600 Gustavo A. R. Silva wrote: > --- a/drivers/net/ethernet/netronome/nfp/nfp_net_debugdump.c > +++ b/drivers/net/ethernet/netronome/nfp/nfp_net_debugdump.c > @@ -34,8 +34,11 @@ enum nfp_dumpspec_type { > > /* generic type plus length */ > struct nfp_dump_tl { > -

Re: [PATCH net-next 2/3] idpf: make virtchnl2.h self-contained

2024-03-26 Thread Jakub Kicinski
On Tue, 26 Mar 2024 17:41:15 +0100 Alexander Lobakin wrote: > To ease maintaining of virtchnl2.h, which already is messy enough, > make it self-contained by adding missing if_ether.h include due to > %ETH_ALEN usage. > At the same time, virtchnl2_lan_desc.h is not used anywhere in the > file, so re

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

2024-03-12 Thread Jakub Kicinski
On Tue, 12 Mar 2024 11:55:19 -0600 Gustavo A. R. Silva wrote: > -Wflex-array-member-not-at-end is coming in GCC-14, and we are getting > ready to enable it globally. ## Form letter - net-next-closed The merge window for v6.9 has begun and we have already posted our pull request. Therefore net-nex

Re: [PATCH] netdev: Use flexible array for trailing private bytes

2024-03-06 Thread Jakub Kicinski
On Wed, 6 Mar 2024 05:16:16 -0800 Breno Leitao wrote: > I've been looking at some of these embedders as reported by Kees[1], and > most of them are for dummy interfaces. I.e, they are basically used for > schedule NAPI poll. > > From that list[1], most of the driver matches with: > > # git

Re: [PATCH] netdev: Use flexible array for trailing private bytes

2024-03-04 Thread Jakub Kicinski
On Mon, 4 Mar 2024 15:32:51 +0100 Alexander Lobakin wrote: > > 100% I should have linked to the thread that led to Kees's work. > > Adding directly to net_device would be way better but there's > > a handful of drivers which embed the struct. > > I think it's okay to embed a struct with flex arr

Re: [PATCH] netdev: Use flexible array for trailing private bytes

2024-03-01 Thread Jakub Kicinski
On Fri, 1 Mar 2024 15:30:03 +0100 Alexander Lobakin wrote: > I like the idea of declaring priv explicitly rather than doing size + > ptr magic. But maybe we could just add this flex array to struct > net_device and avoid introducing a new structure. 100% I should have linked to the thread that led

Re: [PATCH] netdev: Use flexible array for trailing private bytes

2024-02-29 Thread Jakub Kicinski
On Thu, 29 Feb 2024 13:30:22 -0800 Kees Cook wrote: > Introduce a new struct net_device_priv that contains struct net_device > but also accounts for the commonly trailing bytes through the "size" and > "data" members. I'm a bit unclear on the benefit. Perhaps I'm unaccustomed to "safe C". > As ma

Re: [PATCH v4 7/8] net-device: Use new helpers from overflow.h in netdevice APIs

2024-02-29 Thread Jakub Kicinski
On Thu, 29 Feb 2024 11:08:58 -0800 Kees Cook wrote: > > And some seem to be cargo-culted from out-of-tree code and are unused :S > > Ah, which can I remove? The one in igc.h does not seem to be referenced by anything in the igc directory. Pretty sure it's unused. > As a further aside, this cod

Re: [PATCH v4 7/8] net-device: Use new helpers from overflow.h in netdevice APIs

2024-02-28 Thread Jakub Kicinski
On Wed, 28 Feb 2024 19:03:12 -0600 Gustavo A. R. Silva wrote: > On 2/28/24 18:57, Jakub Kicinski wrote: > > On Wed, 28 Feb 2024 18:49:25 -0600 Gustavo A. R. Silva wrote: > >> struct net_device { > >>struct_group_tagged(net_device_hdr, hdr, > >>

Re: [PATCH v4 7/8] net-device: Use new helpers from overflow.h in netdevice APIs

2024-02-28 Thread Jakub Kicinski
On Wed, 28 Feb 2024 18:49:25 -0600 Gustavo A. R. Silva wrote: > struct net_device { > struct_group_tagged(net_device_hdr, hdr, > ... > u32 priv_size; > ); > u8 priv_data[] __counted_by(priv_size) > __aligned(NET

Re: [PATCH v4 7/8] net-device: Use new helpers from overflow.h in netdevice APIs

2024-02-28 Thread Jakub Kicinski
On Wed, 28 Feb 2024 16:01:49 -0800 Kees Cook wrote: > So, I found several cases where struct net_device is included in the > middle of another structure, which makes my proposal more awkward. But I > also don't understand why it's in the _middle_. Shouldn't it always be > at the beginning (with pri

Re: [PATCH v4 7/8] net-device: Use new helpers from overflow.h in netdevice APIs

2024-02-28 Thread Jakub Kicinski
On Wed, 28 Feb 2024 13:46:10 -0800 Kees Cook wrote: > I really don't like hiding these trailing allocations from the compiler. > Why can't something like this be done (totally untested): > > > diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h > index 118c40258d07..dae6df4fb177 10

Re: [PATCH 2/2] net/ipv4: Annotate imsf_slist_flex with __counted_by(imsf_numsrc)

2024-02-12 Thread Jakub Kicinski
On Fri, 9 Feb 2024 17:16:42 -0800 Kees Cook wrote: > The size of the imsf_slist_flex member is determined by imsf_numsrc, so > annotate it as such. Acked-by: Jakub Kicinski

Re: KFENCE: included in x86 defconfig?

2024-02-07 Thread Jakub Kicinski
On Wed, 7 Feb 2024 20:04:44 +0100 Borislav Petkov wrote: > On Wed, Feb 07, 2024 at 07:35:53PM +0100, Matthieu Baerts wrote: > > Sorry, I'm sure I understand your suggestion: do you mean not including > > KFENCE in hardening.config either, but in another one? > > > > For the networking tests, we ar

Re: [PATCH] netlink: Return unsigned value for nla_len()

2023-12-01 Thread Jakub Kicinski
On Fri, 1 Dec 2023 20:39:44 -0800 Kees Cook wrote: > > We are reading nla->nla_len, which is the first 2 bytes of the structure. > > And then we check if the structure is... there? > > I'm not debating whether it's there or not -- I'm saying the _contents_ of > "nlattr::nla_len", in the face of

Re: [PATCH] netlink: Return unsigned value for nla_len()

2023-12-01 Thread Jakub Kicinski
On Fri, 1 Dec 2023 10:17:02 -0800 Kees Cook wrote: > > > -static inline int nla_len(const struct nlattr *nla) > > > +static inline u16 nla_len(const struct nlattr *nla) > > > { > > > - return nla->nla_len - NLA_HDRLEN; > > > + return nla->nla_len > NLA_HDRLEN ? nla->nla_len - NLA_HDRLEN : 0; > > >

Re: [PATCH] net: mdio: replace deprecated strncpy with strscpy

2023-11-30 Thread Jakub Kicinski
On Thu, 30 Nov 2023 14:00:33 -0800 Kees Cook wrote: > Applied to for-next/hardening, thanks! > > [1/1] net: mdio: replace deprecated strncpy with strscpy > https://git.kernel.org/kees/c/3247bb945786 newer version of this was posted...

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

2023-11-30 Thread Jakub Kicinski
On Thu, 30 Nov 2023 14:00:28 -0800 Kees Cook wrote: > [1/1] qlcnic: replace deprecated strncpy with strscpy > https://git.kernel.org/kees/c/f8bef1ef8095 You asked for changes yourself here, please drop all the networking patches you applied today :|

Re: [PATCH] net: ena: replace deprecated strncpy with strscpy

2023-11-30 Thread Jakub Kicinski
On Thu, 30 Nov 2023 13:59:48 -0800 Kees Cook wrote: > [1/1] net: ena: replace deprecated strncpy with strscpy > https://git.kernel.org/kees/c/111f5a435d33 Again, please drop, Arthur requested for the commit message to be changed.

Re: [PATCH v2] net: dsa: lan9303: use ethtool_sprintf() for lan9303_get_strings()

2023-11-30 Thread Jakub Kicinski
On Thu, 30 Nov 2023 13:59:58 -0800 Kees Cook wrote: > Applied to for-next/hardening, thanks! > > [1/1] net: dsa: lan9303: use ethtool_sprintf() for lan9303_get_strings() > https://git.kernel.org/kees/c/f1c7720549bf Please drop this, it got changes requested on our end because I figured Alex

Re: [PATCH] netlink: Return unsigned value for nla_len()

2023-11-30 Thread Jakub Kicinski
On Thu, 30 Nov 2023 12:01:01 -0800 Kees Cook wrote: > This has the additional benefit of being defensive in the face of nlattr > corruption or logic errors (i.e. nla_len being set smaller than > NLA_HDRLEN). As Johannes predicted I'd rather not :( The callers should put the nlattr thru nla_ok() d

Re: [PATCH] net: cpmac: replace deprecated strncpy with strscpy

2023-10-16 Thread Jakub Kicinski
On Thu, 12 Oct 2023 20:53:30 + 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. This driver no longer exists. Praise be. -- pw-bot: reject

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

2023-10-10 Thread Jakub Kicinski
On Tue, 10 Oct 2023 17:47:31 -0700 Jakub Kicinski wrote: > Please do read the netdev rules Jesse pointed you at. > Maybe it's the combined flow of strncpy and __counted_by patches > but managing the state of the "hardening" patches is getting > a bit tedious :(

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

2023-10-10 Thread Jakub Kicinski
On Tue, 10 Oct 2023 14:41:10 -0700 Justin Stitt wrote: > > Thanks Justin for these patches, please make sure you mark the subject > > line as per the netdev rules: > > [PATCH net-next v1] etc etc > > Sure, I'll resend! Please do read the netdev rules Jesse pointed you at. Maybe it's the combine

Re: [PATCH 0/5] chelsio: Annotate structs with __counted_by

2023-10-06 Thread Jakub Kicinski
On Fri, 6 Oct 2023 01:58:54 +0530 Ayush Sawal wrote: >  The current maintainer for cxgb4 driver is Sourabh Sagar > , I have added him in the CC. >  He will update the MAINTAINERS file for cxgb4 driver. Thanks & looking forward to the update!

Re: [PATCH 0/5] chelsio: Annotate structs with __counted_by

2023-10-02 Thread Jakub Kicinski
On Fri, 29 Sep 2023 12:44:45 -0700 Kees Cook wrote: > On Fri, Sep 29, 2023 at 11:11:44AM -0700, Kees Cook wrote: > > Hi, > > > > This annotates several chelsio structures with the coming __counted_by > > attribute for bounds checking of flexible arrays at run-time. For more > > details, > > see c

Re: [PATCH 00/14] Batch 1: Annotate structs with __counted_by

2023-10-02 Thread Jakub Kicinski
On Wed, 27 Sep 2023 08:57:36 -0700 Kees Cook wrote: > > Since the element count member must be set before accessing the annotated > > flexible array member, some patches also move the member's initialization > > earlier. (These are noted in the individual patches.) > > Hi, just checking on this