diff options
author | Kumar Gala <galak@kernel.crashing.org> | 2007-02-12 21:28:39 -0600 |
---|---|---|
committer | Kumar Gala <galak@kernel.crashing.org> | 2007-02-12 21:28:39 -0600 |
commit | 67c2b7d9d224232ee730b9c9444abed824b62e7a (patch) | |
tree | 61a48c2e3562f8f66c04fd02691390dec96466e1 /fs/configfs | |
parent | 49baa91d6863df480fa05eb57524a274f77fa886 (diff) | |
parent | 5986a2ec35836a878350c54af4bd91b1de6abc59 (diff) |
Merge branch 'master' into 83xx
Diffstat (limited to 'fs/configfs')
-rw-r--r-- | fs/configfs/file.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/fs/configfs/file.c b/fs/configfs/file.c index 2a7cb086e80c..d98be5e01328 100644 --- a/fs/configfs/file.c +++ b/fs/configfs/file.c @@ -162,14 +162,17 @@ fill_write_buffer(struct configfs_buffer * buffer, const char __user * buf, size int error; if (!buffer->page) - buffer->page = (char *)get_zeroed_page(GFP_KERNEL); + buffer->page = (char *)__get_free_pages(GFP_KERNEL, 0); if (!buffer->page) return -ENOMEM; - if (count > PAGE_SIZE) - count = PAGE_SIZE; + if (count >= PAGE_SIZE) + count = PAGE_SIZE - 1; error = copy_from_user(buffer->page,buf,count); buffer->needs_read_fill = 1; + /* if buf is assumed to contain a string, terminate it by \0, + * so e.g. sscanf() can scan the string easily */ + buffer->page[count] = 0; return error ? -EFAULT : count; } |