| From: |
| Kees Cook <keescook-AT-chromium.org> |
| To: |
| Rasmus Villemoes <linux-AT-rasmusvillemoes.dk> |
| Subject: |
| [PATCH 0/2] overflow: Implement size_t saturating arithmetic helpers |
| Date: |
| Mon, 20 Sep 2021 11:08:51 -0700 |
| Message-ID: |
| <20210920180853.1825195-1-keescook@chromium.org> |
| Cc: |
| Kees Cook <keescook-AT-chromium.org>, "Gustavo A. R. Silva" <gustavoars-AT-kernel.org>, Nathan Chancellor <nathan-AT-kernel.org>, Jason Gunthorpe <jgg-AT-ziepe.ca>, Nick Desaulniers <ndesaulniers-AT-google.com>, Leon Romanovsky <leon-AT-kernel.org>, Keith Busch <kbusch-AT-kernel.org>, Len Baker <len.baker-AT-gmx.com>, linux-kernel-AT-vger.kernel.org, linux-hardening-AT-vger.kernel.org |
| Archive-link: |
| Article |
Hi,
While doing more array_size() scans on the kernel, and reviewing recent
struct_size() work[1], it became clear we needed helpers to perform
composed saturating add and multiplies. This creates those helpers and
updates the self tests to check them.
Thanks,
-Kees
[1] https://lore.kernel.org/lkml/?q=%22open-coded+arithmetic%22
Kees Cook (2):
overflow: Implement size_t saturating arithmetic helpers
test_overflow: Regularize test reporting output
include/linux/overflow.h | 140 ++++++++++++++++++++++++---------------
lib/test_overflow.c | 111 ++++++++++++++++++++++++-------
2 files changed, 175 insertions(+), 76 deletions(-)
--
2.30.2