Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1220340 > unrolled thread

[PATCH] sysfs.txt: mention that store method buffers are null-terminated

Started byulfalizer.lkml@gmail.com
First post2015-09-07 19:10 +0200
Last post2015-09-12 22:20 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] sysfs.txt: mention that store method buffers are null-terminated ulfalizer.lkml@gmail.com - 2015-09-07 19:10 +0200
    Re: [PATCH] sysfs.txt: mention that store method buffers are  null-terminated Jonathan Corbet <corbet@lwn.net> - 2015-09-12 22:20 +0200

#1220340 — [PATCH] sysfs.txt: mention that store method buffers are null-terminated

Fromulfalizer.lkml@gmail.com
Date2015-09-07 19:10 +0200
Subject[PATCH] sysfs.txt: mention that store method buffers are null-terminated
Message-ID<q685A-3mv-9@gated-at.bofh.it>
From: Ulf Magnusson <ulfalizer@gmail.com>

Without knowing this, the use of sysfs_streq() becomes puzzling.

The termination happens in kernfs_fop_write().

Signed-off-by: Ulf Magnusson <ulfalizer@gmail.com>
---
 Documentation/filesystems/sysfs.txt | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/Documentation/filesystems/sysfs.txt b/Documentation/filesystems/sysfs.txt
index 9494afb..575e997 100644
--- a/Documentation/filesystems/sysfs.txt
+++ b/Documentation/filesystems/sysfs.txt
@@ -198,6 +198,9 @@ implementations:
   entire file, modify the values it wishes to change, then write the
   entire buffer back. 
 
+  A terminating null is added after the data on stores. This makes
+  functions like sysfs_streq() safe to use.
+
   Attribute method implementations should operate on an identical
   buffer when reading and writing values. 
 
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1223460 — Re: [PATCH] sysfs.txt: mention that store method buffers are null-terminated

FromJonathan Corbet <corbet@lwn.net>
Date2015-09-12 22:20 +0200
SubjectRe: [PATCH] sysfs.txt: mention that store method buffers are null-terminated
Message-ID<q7Zrc-2G3-13@gated-at.bofh.it>
In reply to#1220340
On Mon,  7 Sep 2015 19:06:14 +0200
ulfalizer.lkml@gmail.com wrote:

> Without knowing this, the use of sysfs_streq() becomes puzzling.
> 
> The termination happens in kernfs_fop_write().

Applied to the docs tree.  I moved it up a paragraph, though, since it
better fits the flow of the document there.

Thanks,

jon
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web