diff mbox series

[v1,1/1] mm/util: Rephrase documentation for kmemdup_nul() to clarify input

Message ID 20210719122002.41334-1-andriy.shevchenko@linux.intel.com (mailing list archive)
State New
Headers show
Series [v1,1/1] mm/util: Rephrase documentation for kmemdup_nul() to clarify input | expand

Commit Message

Andy Shevchenko July 19, 2021, 12:20 p.m. UTC
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(-)

Comments

Matthew Wilcox July 19, 2021, 12:44 p.m. UTC | #1
On Mon, Jul 19, 2021 at 03:20:02PM +0300, Andy Shevchenko wrote:
> 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).

That's not a useful thing to do, though.  This rephrasing you've
done is more confusing than the original.
Andy Shevchenko July 19, 2021, 12:57 p.m. UTC | #2
On Mon, Jul 19, 2021 at 01:44:22PM +0100, Matthew Wilcox wrote:
> On Mon, Jul 19, 2021 at 03:20:02PM +0300, Andy Shevchenko wrote:
> > 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).
> 
> That's not a useful thing to do, though.  This rephrasing you've
> done is more confusing than the original.

Okay, then drop it. Sorry for the noise.
diff mbox series

Patch

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)
 {