David Rientjes
45b588d6e5
flex_array: introduce DEFINE_FLEX_ARRAY
...
FLEX_ARRAY_INIT(element_size, total_nr_elements) cannot determine if
either parameter is valid, so flex arrays which are statically allocated
with this interface can easily become corrupted or reference beyond its
allocated memory.
This removes FLEX_ARRAY_INIT() as a struct flex_array initializer since no
initializer may perform the required checking. Instead, the array is now
defined with a new interface:
DEFINE_FLEX_ARRAY(name, element_size, total_nr_elements)
This may be prefixed with `static' for file scope.
This interface includes compile-time checking of the parameters to ensure
they are valid. Since the validity of both element_size and
total_nr_elements depend on FLEX_ARRAY_BASE_SIZE and FLEX_ARRAY_PART_SIZE,
the kernel build will fail if either of these predefined values changes
such that the array parameters are no longer valid.
Since BUILD_BUG_ON() requires compile time constants, several of the
static inline functions that were once local to lib/flex_array.c had to be
moved to include/linux/flex_array.h.
Signed-off-by: David Rientjes <rientjes@google.com >
Acked-by: Dave Hansen <dave@linux.vnet.ibm.com >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2009-09-22 07:17:47 -07:00
..
2009-09-12 11:51:14 +01:00
2009-09-04 02:16:14 -07:00
2009-09-19 00:51:34 -03:00
2009-09-17 09:47:22 +02:00
2009-08-27 22:05:39 -07:00
2009-09-22 07:17:25 -07:00
2009-09-18 09:47:25 -07:00
2009-09-15 09:37:12 -07:00
2009-09-17 09:47:05 +02:00
2009-09-09 11:19:00 -04:00
2009-09-19 13:13:33 -07:00
2009-09-20 16:09:20 +05:30
2009-09-01 01:14:07 -07:00
2009-09-01 19:47:20 -04:00
2009-09-15 09:50:47 -07:00
2009-09-16 15:18:52 +02:00
2009-09-05 11:30:42 -07:00
2009-09-11 14:33:31 +02:00
2009-09-11 14:33:32 +02:00
2009-09-14 08:24:53 +02:00
2009-09-22 07:17:38 -07:00
2009-08-28 20:25:24 +02:00
2009-09-01 12:45:14 -04:00
2009-09-14 12:34:07 +10:00
2009-09-19 13:13:31 -07:00
2009-09-01 01:24:30 -07:00
2009-09-18 09:48:52 -07:00
2009-09-04 20:40:25 +01:00
2009-09-19 12:50:38 -07:00
2009-09-04 20:40:34 +01:00
2009-08-28 14:24:10 +10:00
2009-09-08 21:17:48 -04:00
2009-09-14 17:41:42 -07:00
2009-09-02 23:07:39 -07:00
2009-09-22 07:17:47 -07:00
2009-09-22 07:17:25 -07:00
2009-09-18 07:25:44 +02:00
2009-09-20 16:58:35 +05:30
2009-09-22 07:17:25 -07:00
2009-09-22 07:17:38 -07:00
2009-09-11 13:23:18 -07:00
2009-09-19 13:13:31 -07:00
2009-09-01 01:13:31 -07:00
2009-09-13 20:09:41 +02:00
2009-09-22 07:17:42 -07:00
2009-09-19 00:16:14 -03:00
2009-09-01 17:52:57 -07:00
2009-08-28 14:40:24 -04:00
2009-09-11 12:54:58 -07:00
2009-09-07 01:56:33 -07:00
2009-09-15 02:37:40 -07:00
2009-09-21 14:28:04 +02:00
2009-09-14 17:55:15 -07:00
2009-08-26 15:41:16 -07:00
2009-09-11 13:21:31 -07:00
2009-08-29 15:53:00 +02:00
2009-09-16 17:44:10 +02:00
2009-09-10 10:46:47 +03:00
2009-09-02 21:29:22 +10:00
2009-09-02 21:29:22 +10:00
2009-09-19 13:13:17 -07:00
2009-09-04 16:05:55 +01:00
2009-08-27 14:29:16 +01:00
2009-09-15 23:51:31 -04:00
2009-09-22 07:17:33 -07:00
2009-09-18 21:22:08 +02:00
2009-09-10 08:33:20 +03:00
2009-09-10 08:33:16 +03:00
2009-09-01 19:47:20 -04:00
2009-08-31 17:30:14 -10:00
2009-09-22 07:17:35 -07:00
2009-09-19 12:50:38 -07:00
2009-09-22 07:17:37 -07:00
2009-09-22 07:17:41 -07:00
2009-09-22 07:17:42 -07:00
2009-09-22 07:17:31 -07:00
2009-09-22 07:17:39 -07:00
2009-09-18 21:22:08 +02:00
2009-09-15 02:39:20 -07:00
2009-09-17 20:53:52 -07:00
2009-09-14 17:02:50 -07:00
2009-09-08 19:50:03 -04:00
2009-09-15 02:37:40 -07:00
2009-09-22 07:17:38 -07:00
2009-09-20 16:57:50 +05:30
2009-09-22 07:17:38 -07:00
2009-09-14 17:39:12 -07:00
2009-09-17 16:47:06 -04:00
2009-09-15 09:50:48 -07:00
2009-09-09 14:19:11 -07:00
2009-09-15 09:39:44 -07:00
2009-09-21 14:34:11 +02:00
2009-09-21 14:34:11 +02:00
2009-09-11 12:55:10 -07:00
2009-09-14 20:27:00 +02:00
2009-09-22 07:17:47 -07:00
2009-09-21 14:28:04 +02:00
2009-09-22 07:17:24 -07:00
2009-09-19 08:53:22 +02:00
2009-09-19 08:53:22 +02:00
2009-09-19 08:53:22 +02:00
2009-09-01 12:48:21 -04:00
2009-09-04 19:42:22 -04:00
2009-09-22 07:17:31 -07:00
2009-09-09 03:42:23 -07:00
2009-09-15 02:44:17 -07:00
2009-09-22 07:17:45 -07:00
2009-09-10 10:11:24 +10:00
2009-09-15 11:37:33 +10:00
2009-09-19 13:13:19 -07:00
2009-09-19 13:13:32 -07:00
2009-09-19 13:13:30 -07:00
2009-09-15 09:50:49 -07:00
2009-09-14 20:19:06 +03:00
2009-08-31 18:08:51 +02:00
2009-08-31 18:08:51 +02:00
2009-09-22 07:17:25 -07:00
2009-09-21 09:15:07 -07:00
2009-09-18 09:48:52 -07:00
2009-09-01 18:25:07 -07:00
2009-09-02 01:03:43 -07:00
2009-09-15 10:17:30 +02:00
2009-08-30 22:26:34 +02:00
2009-09-16 16:44:33 +02:00
2009-08-26 08:29:02 +02:00
2009-09-15 09:50:47 -07:00
2009-09-19 13:13:35 -07:00
2009-09-19 12:50:38 -07:00
2009-08-26 12:39:29 +01:00
2009-09-09 13:29:41 -07:00
2009-09-19 00:18:36 -03:00
2009-09-22 07:17:30 -07:00
2009-09-19 13:13:25 -07:00
2009-09-19 13:13:26 -07:00
2009-09-15 16:51:30 +02:00
2009-09-05 11:30:42 -07:00
2009-09-16 15:18:52 +02:00
2009-09-10 10:11:22 +10:00