Skip to content

Commit

Permalink
docs/core-api: memory-allocation: mention size helpers
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
cpackham-atlnz authored and Jonathan Corbet committed Oct 29, 2019
1 parent 094ef1c commit 1c16b3d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Documentation/core-api/memory-allocation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 1c16b3d

Please sign in to comment.