[PATCH] kunit/fortify: Fix memcmp() test to be amplitude agnostic

2024-05-18 Thread Kees Cook
When memcmp() returns a non-zero value, only the signed bit has any meaning. The actual value may differ between implementations. Reported-by: Nathan Chancellor Closes: https://github.com/ClangBuiltLinux/linux/issues/2025 Tested-by: Nathan Chancellor Signed-off-by: Kees Cook --- Cc: linux-harde

Re: [WARNING] memcpy: detected field-spanning write (size 1005) of single field "&out_cmd->cmd.payload" at drivers/net/wireless/intel/iwlegacy/common.c:3173 (size 320)

2024-05-18 Thread Kees Cook
On Sat, May 18, 2024 at 11:29:39AM +0200, Stanislaw Gruszka wrote: > Hi > > On Fri, Apr 12, 2024 at 07:48:39PM +0200, Xose Vazquez Perez wrote: > > Hi, > > > > In Fedora kernel 6.8.5-301.fc40.x86_64, dmesg shows: > > > > [ device: 03:00.0 Network controller [0280]: Intel Corporation PRO/Wireless

RE: [RFC] Mitigating unexpected arithmetic overflow

2024-05-18 Thread David Laight
From: Dan Carpenter > Sent: 14 May 2024 09:45 > > Snipped all the bits where you are clearly correct. > > On Mon, May 13, 2024 at 12:43:37PM -0700, Kees Cook wrote: > > > drivers/usb/class/usbtmc.c:852 usbtmc_generic_read() warn: potential > > > integer overflow from user > 'max_transfer_size +

RE: [RFC] Mitigating unexpected arithmetic overflow

2024-05-18 Thread David Laight
From: Kees Cook > Sent: 16 May 2024 14:31 > > On May 15, 2024 12:36:36 AM PDT, Peter Zijlstra wrote: > >On Wed, May 08, 2024 at 04:47:25PM -0700, Linus Torvalds wrote: > >> For example, the most common case of overflow we've ever had has very > >> much been array indexing. Now, sometimes that has

[PATCH v2 2/2] Bluetooth: hci_core: Prefer array indexing over pointer arithmetic

2024-05-18 Thread Erick Archer
Refactor the list_for_each_entry() loop of hci_get_dev_list() function to use array indexing instead of pointer arithmetic. This way, the code is more readable and idiomatic. Reviewed-by: Kees Cook Signed-off-by: Erick Archer --- net/bluetooth/hci_core.c | 4 ++-- 1 file changed, 2 insertions(

[PATCH v2 1/2] Bluetooth: hci_core: Prefer struct_size over open coded arithmetic

2024-05-18 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 0/2] Bluetooth: hci_core: Refactor hci_get_dev_list() function

2024-05-18 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