mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: ulfalizer.lkml@gmail.com
To: corbet@lwn.net
Cc: gregkh@linuxfoundation.org, shane.seymour@hp.com,
	ulfalizer@gmail.com, linux-doc@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: [PATCH] sysfs.txt: mention that store method buffers are null-terminated
Date: Mon,  7 Sep 2015 19:06:14 +0200	[thread overview]
Message-ID: <1441645574-6043-1-git-send-email-ulfalizer.lkml@gmail.com> (raw)

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


             reply	other threads:[~2015-09-07 17:06 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-07 17:06 ulfalizer.lkml [this message]
2015-09-12 20:19 ` 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=1441645574-6043-1-git-send-email-ulfalizer.lkml@gmail.com \
    --to=ulfalizer.lkml@gmail.com \
    --cc=corbet@lwn.net \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=shane.seymour@hp.com \
    --cc=ulfalizer@gmail.com \
    /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

all inboxes | Powered by JetHome®