LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: linux-mm@kvack.org, linux-kernel@vger.kernel.org
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Subject: [PATCH v1 1/1] mm/util: Rephrase documentation for kmemdup_nul() to clarify input
Date: Mon, 19 Jul 2021 15:20:02 +0300	[thread overview]
Message-ID: <20210719122002.41334-1-andriy.shevchenko@linux.intel.com> (raw)

kmemdup_nul() strictly speaking is not related to the string API,
while being quite useful for it. Rephrase documentation to make it
clear that input data can be anything (any data, which may contain
any bytes, including 0x00).

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 mm/util.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/mm/util.c b/mm/util.c
index 9043d03750a7..3b717d34753b 100644
--- a/mm/util.c
+++ b/mm/util.c
@@ -133,13 +133,16 @@ void *kmemdup(const void *src, size_t len, gfp_t gfp)
 EXPORT_SYMBOL(kmemdup);
 
 /**
- * kmemdup_nul - Create a NUL-terminated string from unterminated data
+ * kmemdup_nul - Create a NUL-terminated data from unterminated one
  * @s: The data to stringify
  * @len: The size of the data
  * @gfp: the GFP mask used in the kmalloc() call when allocating memory
  *
+ * In particular this function is useful to add NUL-termination to
+ * unterminated strings.
+ *
  * Return: newly allocated copy of @s with NUL-termination or %NULL in
- * case of error
+ * case of error.
  */
 char *kmemdup_nul(const char *s, size_t len, gfp_t gfp)
 {
-- 
2.30.2


             reply	other threads:[~2021-07-19 12:19 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-19 12:20 Andy Shevchenko [this message]
2021-07-19 12:44 ` Matthew Wilcox
2021-07-19 12:57   ` Andy Shevchenko

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=20210719122002.41334-1-andriy.shevchenko@linux.intel.com \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --subject='Re: [PATCH v1 1/1] mm/util: Rephrase documentation for kmemdup_nul() to clarify input' \
    /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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).