Kees Cook
fc8ab902e9
overflow.h: Add allocation size calculation helpers
...
In preparation for replacing unchecked overflows for memory allocations,
this creates helpers for the 3 most common calculations:
array_size(a, b): 2-dimensional array
array3_size(a, b, c): 3-dimensional array
struct_size(ptr, member, n): struct followed by n-many trailing members
Each of these return SIZE_MAX on overflow instead of wrapping around.
(Additionally renames a variable named "array_size" to avoid future
collision.)
Co-developed-by: Matthew Wilcox <mawilcox@microsoft.com>
Signed-off-by: Kees Cook <keescook@chromium.org>
2018-07-08 17:40:58 -07:00
..
2017-11-02 11:10:55 +01:00
2017-12-05 11:26:33 +01:00
2017-11-02 11:10:55 +01:00
2017-12-10 13:40:37 +01:00
2017-11-30 08:40:47 +00:00
2017-12-14 09:53:13 +01:00
2017-11-03 09:02:30 -07:00
2018-01-09 17:01:36 -08:00
2017-11-02 11:10:55 +01:00
2017-11-30 08:40:41 +00:00
2017-11-30 08:40:47 +00:00
2017-12-14 09:53:03 +01:00
2017-11-02 11:10:55 +01:00
2018-01-09 17:01:36 -08:00
2017-12-14 09:53:12 +01:00
2018-01-09 17:01:36 -08:00
2017-11-02 11:10:55 +01:00
2017-12-17 15:08:00 +01:00
2018-01-09 17:01:36 -08:00
2017-12-05 11:26:28 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-21 09:49:20 +01:00
2017-12-10 13:40:44 +01:00
2017-12-10 13:40:41 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2018-01-09 17:01:36 -08:00
2017-12-14 09:52:52 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2018-01-09 17:01:36 -08:00
2017-11-21 09:49:23 +01:00
2017-11-02 11:10:55 +01:00
2017-12-14 09:52:49 +01:00
2017-12-10 13:40:40 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-12-05 11:26:33 +01:00
2017-12-17 15:08:00 +01:00
2017-11-04 15:01:50 +01:00
2017-12-14 09:52:49 +01:00
2018-01-09 17:01:36 -08:00
2018-01-09 17:01:36 -08:00
2017-12-14 09:52:55 +01:00
2017-12-14 09:53:05 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-12-14 09:53:12 +01:00
2017-11-02 11:10:55 +01:00
2018-07-08 17:40:58 -07:00
2017-12-17 15:08:01 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-30 08:40:49 +00:00
2018-01-09 17:01:36 -08:00
2017-12-10 13:40:40 +01:00
2017-11-30 08:40:55 +00:00
2018-01-09 17:01:36 -08:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-30 08:40:54 +00:00
2017-12-17 15:08:00 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-12-10 13:40:40 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-12-14 09:52:49 +01:00
2017-12-05 11:26:27 +01:00
2017-11-02 11:10:55 +01:00
2017-11-03 09:02:30 -07:00
2017-09-08 18:26:51 -07:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-12-14 09:53:08 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 10:04:46 -07:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-21 09:49:23 +01:00
2017-11-02 11:10:55 +01:00
2017-12-17 15:07:57 +01:00
2017-11-02 11:10:55 +01:00
2018-01-09 17:01:36 -08:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-12-10 13:40:39 +01:00
2017-11-02 11:10:55 +01:00
2017-12-10 13:40:44 +01:00
2018-01-09 17:01:36 -08:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-12-14 09:52:44 +01:00
2017-11-02 11:10:55 +01:00
2018-01-09 17:01:36 -08:00
2017-11-02 11:10:55 +01:00
2018-01-09 17:01:36 -08:00
2018-01-09 17:01:36 -08:00
2017-11-02 11:10:55 +01:00
2017-12-14 09:52:48 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 10:04:46 -07:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00