From: Jonathan Corbet <corbet@lwn.net>
To: Chris Packham <chris.packham@alliedtelesis.co.nz>
Cc: willy@infradead.org, linux-doc@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] docs/core-api: memory-allocation: mention size helpers
Date: Tue, 22 Oct 2019 07:19:20 -0600 [thread overview]
Message-ID: <20191022071920.4efff72b@lwn.net> (raw)
In-Reply-To: <20191021212751.21300-1-chris.packham@alliedtelesis.co.nz>
On Tue, 22 Oct 2019 10:27:47 +1300
Chris Packham <chris.packham@alliedtelesis.co.nz> wrote:
> Mention struct_size(), array_size() and array3_size() in the same place
> as kmalloc() and friends.
>
> Signed-off-by: Chris Packham <chris.packham@alliedtelesis.co.nz>
> ---
> Documentation/core-api/memory-allocation.rst | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/Documentation/core-api/memory-allocation.rst b/Documentation/core-api/memory-allocation.rst
> index e59779aa7615..6a131767becd 100644
> --- a/Documentation/core-api/memory-allocation.rst
> +++ b/Documentation/core-api/memory-allocation.rst
> @@ -91,7 +91,9 @@ The most straightforward way to allocate memory is to use a function
> from the :c:func:`kmalloc` family. And, to be on the safe side it's
> best to use routines that set memory to zero, like
> :c:func:`kzalloc`. If you need to allocate memory for an array, there
> -are :c:func:`kmalloc_array` and :c:func:`kcalloc` helpers.
> +are :c:func:`kmalloc_array` and :c:func:`kcalloc` helpers. The helpers
> +:c:func:`struct_size`, :c:func:`array_size` and :c:func:`array3_size` can be
> +used to safely calculate object sizes without overflowing.
Quick comment: we don't need :c:func: anymore; the markup happens anyway.
So rather than adding more of them, could I ask you to please take out the
ones that are there now?
Thanks,
jon
next prev parent reply other threads:[~2019-10-22 13:19 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-21 21:27 [PATCH] docs/core-api: memory-allocation: mention size helpers Chris Packham
2019-10-22 13:19 ` Jonathan Corbet [this message]
2019-10-22 20:05 ` Chris Packham
2019-10-22 20:38 ` Jonathan Corbet
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20191022071920.4efff72b@lwn.net \
--to=corbet@lwn.net \
--cc=chris.packham@alliedtelesis.co.nz \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=willy@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox