Re: [PATCH] mtd: maps: sa1100-flash: Prefer struct_size over open coded arithmetic

2024-04-08 Thread Miquel Raynal
On Sat, 2024-03-30 at 17:55:35 UTC, 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 "info" variable is a pointer to "struct sa_info" and this > structure ends in a flexible array: > > st

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 v3] net: dsa: lan9303: use ethtool_puts() for lan9303_get_strings()

2024-04-08 Thread Kees Cook
On Mon, Apr 08, 2024 at 09:01:57PM +, Justin Stitt wrote: > This pattern of strncpy with some pointer arithmetic setting fixed-sized > intervals with string literal data is a bit weird so let's use > ethtool_puts() as this has more obvious behavior and is less-error > prone. > > Nicely, we als

Re: [PATCH v4] checkpatch: add check for snprintf to scnprintf

2024-04-08 Thread Kees Cook
On Mon, Apr 08, 2024 at 08:53:33PM +, Justin Stitt wrote: > I am going to quote Lee Jones who has been doing some snprintf -> > scnprintf refactorings: > > "There is a general misunderstanding amongst engineers that > {v}snprintf() returns the length of the data *actually* encoded into the > d

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

2024-04-08 Thread patchwork-bot+bluetooth
Hello: This patch was applied to bluetooth/bluetooth-next.git (master) by Luiz Augusto von Dentz : On Wed, 27 Mar 2024 10:23:51 -0600 you wrote: > -Wflex-array-member-not-at-end is coming in GCC-14, and we are getting > ready to enable it globally. > > There are currently a couple of objects (`r

Re: [PATCH v3 3/3] net: mana: Avoid open coded arithmetic

2024-04-08 Thread Justin Stitt
Hi, On Sat, Apr 06, 2024 at 04:23:37PM +0200, 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 "req" variable is a pointer to "struct mana_cfg_rx_steer_req_v2" > and this structure ends i

Re: [PATCH v3 1/3] net: mana: Add flex array to struct mana_cfg_rx_steer_req_v2

2024-04-08 Thread Justin Stitt
On Mon, Apr 8, 2024 at 2:35 PM Justin Stitt wrote: > > Hi, > > On Sat, Apr 06, 2024 at 04:23:35PM +0200, Erick Archer wrote: > > The "struct mana_cfg_rx_steer_req_v2" uses a dynamically sized set of > > trailing elements. Specifically, it uses a "mana_handle_t" array. So, > > use the preferred way

Re: [PATCH v3 2/3] RDMA/mana_ib: Prefer struct_size over open coded arithmetic

2024-04-08 Thread Justin Stitt
Hi, On Sat, Apr 06, 2024 at 04:23:36PM +0200, 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 "req" variable is a pointer to "struct mana_cfg_rx_steer_req_v2" > and this structure ends i

Re: [PATCH v3 1/3] net: mana: Add flex array to struct mana_cfg_rx_steer_req_v2

2024-04-08 Thread Justin Stitt
Hi, On Sat, Apr 06, 2024 at 04:23:35PM +0200, Erick Archer wrote: > The "struct mana_cfg_rx_steer_req_v2" uses a dynamically sized set of > trailing elements. Specifically, it uses a "mana_handle_t" array. So, > use the preferred way in the kernel declaring a flexible array [1]. > > At the same t

[PATCH v3] net: dsa: lan9303: use ethtool_puts() for lan9303_get_strings()

2024-04-08 Thread Justin Stitt
This pattern of strncpy with some pointer arithmetic setting fixed-sized intervals with string literal data is a bit weird so let's use ethtool_puts() as this has more obvious behavior and is less-error prone. Nicely, we also get to drop a usage of the now deprecated strncpy() [1]. Link: https:/

[PATCH v4] checkpatch: add check for snprintf to scnprintf

2024-04-08 Thread Justin Stitt
I am going to quote Lee Jones who has been doing some snprintf -> scnprintf refactorings: "There is a general misunderstanding amongst engineers that {v}snprintf() returns the length of the data *actually* encoded into the destination array. However, as per the C99 standard {v}snprintf() really r

RE: [PATCH v3 1/3] net: mana: Add flex array to struct mana_cfg_rx_steer_req_v2

2024-04-08 Thread Long Li
> Subject: [PATCH v3 1/3] net: mana: Add flex array to struct > mana_cfg_rx_steer_req_v2 > > The "struct mana_cfg_rx_steer_req_v2" uses a dynamically sized set of trailing > elements. Specifically, it uses a "mana_handle_t" array. So, use the > preferred way > in the kernel declaring a flexible ar

RE: [PATCH v3 2/3] RDMA/mana_ib: Prefer struct_size over open coded arithmetic

2024-04-08 Thread Long Li
> Subject: [PATCH v3 2/3] RDMA/mana_ib: Prefer struct_size over open coded > arithmetic > > This is an effort to get rid of all multiplications from allocation functions > in order to > prevent integer overflows [1][2]. > > As the "req" variable is a pointer to "struct mana_cfg_rx_steer_req_v2" >

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

2024-04-08 Thread Leon Romanovsky
On Sat, Apr 06, 2024 at 04:23:34PM +0200, Erick Archer wrote: > The "struct mana_cfg_rx_steer_req_v2" uses a dynamically sized set of > trailing elements. Specifically, it uses a "mana_handle_t" array. So, > use the preferred way in the kernel declaring a flexible array [1]. > > At the same time,