diff options
author | Akinobu Mita <akinobu.mita@gmail.com> | 2011-07-19 11:49:25 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-07-20 01:09:30 -0400 |
commit | f7b88631a89757d70192044c9d9f2e8d2fc02f2c (patch) | |
tree | 51da597d7625d2428701be146f233cee047425d9 /fs/libfs.c | |
parent | e501f29c727dea74e2124c584cbab5fa805d489b (diff) |
fs/libfs.c: fix simple_attr_write() on 32bit machines
Assume that /sys/kernel/debug/dummy64 is debugfs file created by
debugfs_create_x64().
# cd /sys/kernel/debug
# echo 0x1234567812345678 > dummy64
# cat dummy64
0x0000000012345678
# echo 0x80000000 > dummy64
# cat dummy64
0xffffffff80000000
A value larger than INT_MAX cannot be written to the debugfs file created
by debugfs_create_u64 or debugfs_create_x64 on 32bit machine. Because
simple_attr_write() uses simple_strtol() for the conversion.
To fix this, use simple_strtoll() instead.
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Cc: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/libfs.c')
-rw-r--r-- | fs/libfs.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/libfs.c b/fs/libfs.c index c88eab55aec9..275ca4749a2e 100644 --- a/fs/libfs.c +++ b/fs/libfs.c | |||
@@ -822,7 +822,7 @@ ssize_t simple_attr_write(struct file *file, const char __user *buf, | |||
822 | goto out; | 822 | goto out; |
823 | 823 | ||
824 | attr->set_buf[size] = '\0'; | 824 | attr->set_buf[size] = '\0'; |
825 | val = simple_strtol(attr->set_buf, NULL, 0); | 825 | val = simple_strtoll(attr->set_buf, NULL, 0); |
826 | ret = attr->set(attr->data, val); | 826 | ret = attr->set(attr->data, val); |
827 | if (ret == 0) | 827 | if (ret == 0) |
828 | ret = len; /* on success, claim we got the whole input */ | 828 | ret = len; /* on success, claim we got the whole input */ |