aboutsummaryrefslogtreecommitdiffstats
path: root/fs/seq_file.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2015-07-01 20:47:51 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2015-07-01 20:47:51 -0400
commit2d01eedf1d14432f4db5388a49dc5596a8c5bd02 (patch)
tree646525acc0475b2899827c1bfbd25f05ec1b8092 /fs/seq_file.c
parent6ac15baacb6ecd87c66209627753b96ded3b4515 (diff)
parentabdd4a7025282fbe3737e1bcb5f51afc8d8ea1b8 (diff)
Merge branch 'akpm' (patches from Andrew)
Merge third patchbomb from Andrew Morton: - the rest of MM - scripts/gdb updates - ipc/ updates - lib/ updates - MAINTAINERS updates - various other misc things * emailed patches from Andrew Morton <akpm@linux-foundation.org>: (67 commits) genalloc: rename of_get_named_gen_pool() to of_gen_pool_get() genalloc: rename dev_get_gen_pool() to gen_pool_get() x86: opt into HAVE_COPY_THREAD_TLS, for both 32-bit and 64-bit MAINTAINERS: add zpool MAINTAINERS: BCACHE: Kent Overstreet has changed email address MAINTAINERS: move Jens Osterkamp to CREDITS MAINTAINERS: remove unused nbd.h pattern MAINTAINERS: update brcm gpio filename pattern MAINTAINERS: update brcm dts pattern MAINTAINERS: update sound soc intel patterns MAINTAINERS: remove website for paride MAINTAINERS: update Emulex ocrdma email addresses bcache: use kvfree() in various places libcxgbi: use kvfree() in cxgbi_free_big_mem() target: use kvfree() in session alloc and free IB/ehca: use kvfree() in ipz_queue_{cd}tor() drm/nouveau/gem: use kvfree() in u_free() drm: use kvfree() in drm_free_large() cxgb4: use kvfree() in t4_free_mem() cxgb3: use kvfree() in cxgb_free_mem() ...
Diffstat (limited to 'fs/seq_file.c')
-rw-r--r--fs/seq_file.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/fs/seq_file.c b/fs/seq_file.c
index 52b492721603..1d9c1cbd4d0b 100644
--- a/fs/seq_file.c
+++ b/fs/seq_file.c
@@ -48,18 +48,21 @@ static void *seq_buf_alloc(unsigned long size)
48 * ERR_PTR(error). In the end of sequence they return %NULL. ->show() 48 * ERR_PTR(error). In the end of sequence they return %NULL. ->show()
49 * returns 0 in case of success and negative number in case of error. 49 * returns 0 in case of success and negative number in case of error.
50 * Returning SEQ_SKIP means "discard this element and move on". 50 * Returning SEQ_SKIP means "discard this element and move on".
51 * Note: seq_open() will allocate a struct seq_file and store its
52 * pointer in @file->private_data. This pointer should not be modified.
51 */ 53 */
52int seq_open(struct file *file, const struct seq_operations *op) 54int seq_open(struct file *file, const struct seq_operations *op)
53{ 55{
54 struct seq_file *p = file->private_data; 56 struct seq_file *p;
57
58 WARN_ON(file->private_data);
59
60 p = kzalloc(sizeof(*p), GFP_KERNEL);
61 if (!p)
62 return -ENOMEM;
63
64 file->private_data = p;
55 65
56 if (!p) {
57 p = kmalloc(sizeof(*p), GFP_KERNEL);
58 if (!p)
59 return -ENOMEM;
60 file->private_data = p;
61 }
62 memset(p, 0, sizeof(*p));
63 mutex_init(&p->lock); 66 mutex_init(&p->lock);
64 p->op = op; 67 p->op = op;
65#ifdef CONFIG_USER_NS 68#ifdef CONFIG_USER_NS