All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] Add kvzalloc_struct to complement kvzalloc_array
@ 2018-02-14 18:26 ` Matthew Wilcox
  0 siblings, 0 replies; 87+ messages in thread
From: Matthew Wilcox @ 2018-02-14 18:26 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Matthew Wilcox, linux-mm, Kees Cook, linux-kernel, kernel-hardening

From: Matthew Wilcox <mawilcox@microsoft.com>

We all know the perils of multiplying a value provided from userspace
by a constant and then allocating the resulting number of bytes.  That's
why we have kvmalloc_array(), so we don't have to think about it.
This solves the same problem when we embed one of these arrays in a
struct like this:

struct {
	int n;
	unsigned long array[];
};

Using kvzalloc_struct() to allocate this will save precious thinking
time and reduce the possibilities of bugs.

Matthew Wilcox (2):
  mm: Add kernel-doc for kvfree
  mm: Add kvmalloc_ab_c and kvzalloc_struct

 include/linux/mm.h | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++
 mm/util.c          | 10 ++++++++++
 2 files changed, 61 insertions(+)

-- 
2.15.1

^ permalink raw reply	[flat|nested] 87+ messages in thread

end of thread, other threads:[~2018-05-04 16:03 UTC | newest]

Thread overview: 87+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-14 18:26 [PATCH 0/2] Add kvzalloc_struct to complement kvzalloc_array Matthew Wilcox
2018-02-14 18:26 ` Matthew Wilcox
2018-02-14 18:26 ` [PATCH 1/2] mm: Add kernel-doc for kvfree Matthew Wilcox
2018-02-14 18:26   ` Matthew Wilcox
2018-02-14 18:26 ` [PATCH 2/2] mm: Add kvmalloc_ab_c and kvzalloc_struct Matthew Wilcox
2018-02-14 18:26   ` Matthew Wilcox
2018-02-14 19:22   ` Kees Cook
2018-02-14 19:22     ` [Cocci] " Kees Cook
2018-02-14 19:22     ` Kees Cook
2018-02-14 19:27     ` Julia Lawall
2018-02-14 19:27       ` [Cocci] " Julia Lawall
2018-02-14 19:27       ` Julia Lawall
2018-02-14 19:35     ` Matthew Wilcox
2018-02-14 19:35       ` [Cocci] " Matthew Wilcox
2018-02-14 19:35       ` Matthew Wilcox
2018-03-07 21:18     ` Julia Lawall
2018-03-07 21:18       ` [Cocci] " Julia Lawall
2018-03-08  2:58       ` Matthew Wilcox
2018-03-08  2:58         ` [Cocci] " Matthew Wilcox
2018-03-08  6:24         ` Julia Lawall
2018-03-08  6:24           ` [Cocci] " Julia Lawall
2018-03-08 23:05           ` Matthew Wilcox
2018-03-08 23:05             ` [Cocci] " Matthew Wilcox
2018-03-09  5:59             ` Julia Lawall
2018-03-09  5:59               ` [Cocci] " Julia Lawall
2018-03-13 17:19             ` Julia Lawall
2018-03-13 17:19               ` [Cocci] " Julia Lawall
2018-03-13 18:32               ` Matthew Wilcox
2018-03-13 18:32                 ` [Cocci] " Matthew Wilcox
2018-03-13 18:35                 ` Julia Lawall
2018-03-13 18:35                   ` [Cocci] " Julia Lawall
2018-04-29 16:59                 ` Kees Cook
2018-04-29 16:59                   ` [Cocci] " Kees Cook
2018-04-29 20:30                   ` Matthew Wilcox
2018-04-29 20:30                     ` [Cocci] " Matthew Wilcox
2018-04-30 19:02                     ` Kees Cook
2018-04-30 19:02                       ` [Cocci] " Kees Cook
2018-04-30 20:16                       ` Matthew Wilcox
2018-04-30 20:16                         ` [Cocci] " Matthew Wilcox
2018-04-30 21:29                         ` Rasmus Villemoes
2018-04-30 21:29                           ` [Cocci] " Rasmus Villemoes
2018-04-30 22:41                           ` Matthew Wilcox
2018-04-30 22:41                             ` [Cocci] " Matthew Wilcox
2018-05-01 17:00                           ` Kees Cook
2018-05-01 17:00                             ` [Cocci] " Kees Cook
2018-05-01 17:41                             ` Julia Lawall
2018-05-01 17:41                               ` [Cocci] " Julia Lawall
2018-05-03 23:00                             ` Rasmus Villemoes
2018-05-03 23:00                               ` [Cocci] " Rasmus Villemoes
2018-05-04  0:36                               ` Kees Cook
2018-05-04  0:36                                 ` [Cocci] " Kees Cook
2018-05-04  0:40                                 ` Kees Cook
2018-05-04  0:40                                   ` [Cocci] " Kees Cook
2018-04-30 22:29                         ` Kees Cook
2018-04-30 22:29                           ` [Cocci] " Kees Cook
2018-02-14 19:55   ` Christopher Lameter
2018-02-14 19:55     ` Christopher Lameter
2018-02-14 20:14     ` Matthew Wilcox
2018-02-14 20:14       ` Matthew Wilcox
2018-02-15 15:55       ` Christopher Lameter
2018-02-15 15:55         ` Christopher Lameter
2018-02-15 16:23         ` Matthew Wilcox
2018-02-15 16:23           ` Matthew Wilcox
2018-02-15 17:06           ` Christopher Lameter
2018-02-15 17:06             ` Christopher Lameter
2018-02-22  1:28             ` Kees Cook
2018-02-22  1:28               ` Kees Cook
2018-05-04  7:42   ` Linus Torvalds
2018-05-04 13:14     ` Matthew Wilcox
2018-05-04 15:35       ` Linus Torvalds
2018-05-04 16:03         ` Kees Cook
2018-02-14 18:47 ` [PATCH 0/2] Add kvzalloc_struct to complement kvzalloc_array Joe Perches
2018-02-14 18:47   ` Joe Perches
2018-02-14 19:23   ` Kees Cook
2018-02-14 19:23     ` Kees Cook
2018-02-14 19:32     ` Joe Perches
2018-02-14 19:32       ` Joe Perches
2018-02-14 19:36       ` Matthew Wilcox
2018-02-14 19:36         ` Matthew Wilcox
2018-02-14 19:43         ` Joe Perches
2018-02-14 19:43           ` Joe Perches
2018-02-14 19:43           ` Joe Perches
2018-02-14 19:56           ` Matthew Wilcox
2018-02-14 19:56             ` Matthew Wilcox
2018-02-14 20:06             ` Joe Perches
2018-02-14 20:06               ` Joe Perches
2018-02-14 20:06               ` Joe Perches

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.