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] Bluetooth: hci_core: Prefer struct_size over open coded arithmetic

2024-05-12 Thread Kees Cook
On Sun, May 12, 2024 at 04:17:06PM +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 "dl" variable is a pointer to "struct hci_dev_list_req" and this > structure ends in a flexible a

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

2024-05-12 Thread Kees Cook
On Sun, May 12, 2024 at 01:17:24PM +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 "dl" variable is a pointer to "struct rfcomm_dev_list_req" and > this structure ends in a flexibl

Re: [RFC] Mitigating unexpected arithmetic overflow

2024-05-12 Thread Martin Uecker
Am Sonntag, dem 12.05.2024 um 09:09 -0700 schrieb Linus Torvalds: > On Sun, 12 May 2024 at 01:03, Martin Uecker wrote: > > > > But I guess it still could be smarter. Or does it have to be a > > sanitizer because compile-time will always have too many false > > positives? > > Yes, there will be w

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

2024-05-12 Thread Erick Archer
The "struct prestera_msg_vtcam_rule_add_req" uses a dynamically sized set of trailing elements. Specifically, it uses an array of structures of type "prestera_msg_acl_action actions_msg". The "struct prestera_msg_flood_domain_ports_set_req" also uses a dynamically sized set of trailing elements. S

Re: [RFC] Mitigating unexpected arithmetic overflow

2024-05-12 Thread Linus Torvalds
On Sun, 12 May 2024 at 01:03, Martin Uecker wrote: > > But I guess it still could be smarter. Or does it have to be a > sanitizer because compile-time will always have too many false > positives? Yes, there will be way too many false positives. I'm pretty sure there will be a ton of "intentional

[PATCH] Bluetooth: hci_core: Prefer struct_size over open coded arithmetic

2024-05-12 Thread Erick Archer
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 hci_dev_list_req" and this structure ends in a flexible array: struct hci_dev_list_req { [...] struct hci_dev_re

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

2024-05-12 Thread Erick Archer
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: struct rfcomm_dev_list_req { [...] struct rf

Re: [RFC] Mitigating unexpected arithmetic overflow

2024-05-12 Thread Martin Uecker
Am Mittwoch, dem 08.05.2024 um 16:47 -0700 schrieb Linus Torvalds: > On Wed, 8 May 2024 at 15:54, Kees Cook wrote: > > ... > > No, the only point where that actually failed was then when a > (non-overflowing, non-wrapping) final value was assigned to a 16-bit > field, ie the problem only ever ha