diff mbox

[3/3] fs: documents seq_open()'s usage of file->private_data

Message ID e5908204510326710a9628469bbcfa1595823f64.1430777196.git.ydroneaud@opteya.com (mailing list archive)
State New, archived
Headers show

Commit Message

Yann Droneaud May 4, 2015, 10:19 p.m. UTC
seq_open() stores its struct seq_file in file->private_data,
thus, it must not be modified by user of seq_file.

Link: http://lkml.kernel.org/r/cover.1430777196.git.ydroneaud@opteya.com
Signed-off-by: Yann Droneaud <ydroneaud@opteya.com>
---
 fs/seq_file.c | 2 ++
 1 file changed, 2 insertions(+)
diff mbox

Patch

diff --git a/fs/seq_file.c b/fs/seq_file.c
index cb9c3dbd1a1e..69d13f62d885 100644
--- a/fs/seq_file.c
+++ b/fs/seq_file.c
@@ -48,6 +48,8 @@  static void *seq_buf_alloc(unsigned long size)
  *	ERR_PTR(error).  In the end of sequence they return %NULL. ->show()
  *	returns 0 in case of success and negative number in case of error.
  *	Returning SEQ_SKIP means "discard this element and move on".
+ *	Note: seq_open() will allocate a struct seq_file and store its
+ *	pointer in @file->private_data. This pointer should not be modified.
  */
 int seq_open(struct file *file, const struct seq_operations *op)
 {