Re: [PATCH] coccinelle: semantic patch to check for potential struct_size calls

From: Kees Cook
Date: Sun Feb 18 2024 - 23:39:45 EST


On Mon, 27 Feb 2023 12:24:28 -0800, Jacob Keller wrote:
> include/linux/overflow.h includes helper macros intended for calculating
> sizes of allocations. These macros prevent accidental overflow by
> saturating at SIZE_MAX.
>
> In general when calculating such sizes use of the macros is preferred. Add
> a semantic patch which can detect code patterns which can be replaced by
> struct_size.
>
> [...]

If this needs tweaking, we can go from this one.

Applied to for-next/hardening, thanks!

[1/1] coccinelle: semantic patch to check for potential struct_size calls
https://git.kernel.org/kees/c/39fc2f86ae6a

Take care,

--
Kees Cook