* [merged] codingstyle-add-kmalloc_array-to-memory-allocators.patch removed from -mm tree
@ 2012-06-01 19:32 akpm
0 siblings, 0 replies; only message in thread
From: akpm @ 2012-06-01 19:32 UTC (permalink / raw)
To: xi.wang, jj, penberg, mm-commits
The patch titled
Subject: CodingStyle: add kmalloc_array() to memory allocators
has been removed from the -mm tree. Its filename was
codingstyle-add-kmalloc_array-to-memory-allocators.patch
This patch was dropped because it was merged into mainline or a subsystem tree
The current -mm tree may be found at http://userweb.kernel.org/~akpm/mmotm/
------------------------------------------------------
From: Xi Wang <xi.wang@gmail.com>
Subject: CodingStyle: add kmalloc_array() to memory allocators
Add the new kmalloc_array() to the list of general-purpose memory
allocators in chapter 14.
Signed-off-by: Xi Wang <xi.wang@gmail.com>
Acked-by: Jesper Juhl <jj@chaosbits.net>
Acked-by: Pekka Enberg <penberg@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
Documentation/CodingStyle | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)
diff -puN Documentation/CodingStyle~codingstyle-add-kmalloc_array-to-memory-allocators Documentation/CodingStyle
--- a/Documentation/CodingStyle~codingstyle-add-kmalloc_array-to-memory-allocators
+++ a/Documentation/CodingStyle
@@ -671,8 +671,9 @@ ones already enabled by DEBUG.
Chapter 14: Allocating memory
The kernel provides the following general purpose memory allocators:
-kmalloc(), kzalloc(), kcalloc(), vmalloc(), and vzalloc(). Please refer to
-the API documentation for further information about them.
+kmalloc(), kzalloc(), kmalloc_array(), kcalloc(), vmalloc(), and
+vzalloc(). Please refer to the API documentation for further information
+about them.
The preferred form for passing a size of a struct is the following:
@@ -686,6 +687,17 @@ Casting the return value which is a void
from void pointer to any other pointer type is guaranteed by the C programming
language.
+The preferred form for allocating an array is the following:
+
+ p = kmalloc_array(n, sizeof(...), ...);
+
+The preferred form for allocating a zeroed array is the following:
+
+ p = kcalloc(n, sizeof(...), ...);
+
+Both forms check for overflow on the allocation size n * sizeof(...),
+and return NULL if that occurred.
+
Chapter 15: The inline disease
_
Patches currently in -mm which might be from xi.wang@gmail.com are
origin.patch
linux-next.patch
introduce-size_max.patch
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2012-06-01 19:32 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-06-01 19:32 [merged] codingstyle-add-kmalloc_array-to-memory-allocators.patch removed from -mm tree akpm
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.