Re: [PATCH 00/82] overflow: Refactor open-coded arithmetic wrap-around

2024-01-28 Thread Kees Cook
On Tue, Jan 23, 2024 at 09:46:35AM +, Mark Rutland wrote: > This also misses the include/linux/atomic/atomic-arch-fallback.h > implementations. Those are generated from the scripts/atomic/fallbacks/* > templates, and you'll need to adjust at least fetch_add_unless and > inc_unless_negative. As

Re: [PATCH] bus: mhi: ep: Use kcalloc() instead of kzalloc()

2024-01-28 Thread Dan Carpenter
On Sun, Jan 28, 2024 at 11:29:33AM +0100, Erick Archer wrote: > > It's a bit concerning that ->event_rings is set multiple times, but only > > allocated one time. It's either unnecessary or there is a potential > > memory corruption bug. If it's really necessary then there should be a > > check t

[PATCH] dmaengine: pl08x: Use kcalloc() instead of kzalloc()

2024-01-28 Thread Erick Archer
This is an effort to get rid of all multiplications from allocation functions in order to prevent integer overflows [1]. Here the multiplication is obviously safe because the "channels" member can only be 8 or 2. This value is set when the "vendor_data" structs are initialized. static struct vend

[PATCH v2] bus: mhi: ep: Use kcalloc() instead of kzalloc()

2024-01-28 Thread Erick Archer
This is an effort to get rid of all multiplications from allocation functions in order to prevent integer overflows [1]. Here the multiplication is obviously safe because the "event_rings" member never can have a value greater than 255 (8 bits). This member is set twice using always FIELD_GET: mh

Re: [PATCH] bus: mhi: ep: Use kcalloc() instead of kzalloc()

2024-01-28 Thread Erick Archer
Hi Dan, On Mon, Jan 22, 2024 at 10:15:20AM +0300, Dan Carpenter wrote: > This code does not have an integer overflow, but it might have a > different memory corruption bug. I don't see this possible memory corruption bug. More info below. > On Sat, Jan 20, 2024 at 04:25:18PM +0100, Erick Archer