aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Packham <[email protected]>2019-10-25 08:50:16 +1300
committerJonathan Corbet <[email protected]>2019-10-29 04:45:40 -0600
commit1c16b3d58681b583157a1b74c4c4dd96a08f5931 (patch)
tree7d6cbcc5cc8712cd9b1208fcc5abd0a8de5e5d84
parent094ef1c9fbeac0e4404d66a053ace6d909386507 (diff)
docs/core-api: memory-allocation: mention size helpers
Mention struct_size(), array_size() and array3_size() in the same place as kmalloc() and friends. Signed-off-by: Chris Packham <[email protected]> Acked-by: Mike Rapoport <[email protected]> Reviewed-by: Matthew Wilcox (Oracle) <[email protected]> Signed-off-by: Jonathan Corbet <[email protected]>
-rw-r--r--Documentation/core-api/memory-allocation.rst3
1 files changed, 2 insertions, 1 deletions
diff --git a/Documentation/core-api/memory-allocation.rst b/Documentation/core-api/memory-allocation.rst
index e47d48655085..4aa82ddd01b8 100644
--- a/Documentation/core-api/memory-allocation.rst
+++ b/Documentation/core-api/memory-allocation.rst
@@ -91,7 +91,8 @@ The most straightforward way to allocate memory is to use a function
from the kmalloc() family. And, to be on the safe side it's best to use
routines that set memory to zero, like kzalloc(). If you need to
allocate memory for an array, there are kmalloc_array() and kcalloc()
-helpers.
+helpers. The helpers struct_size(), array_size() and array3_size() can
+be used to safely calculate object sizes without overflowing.
The maximal size of a chunk that can be allocated with `kmalloc` is
limited. The actual limit depends on the hardware and the kernel