Skip to content

Commit f7b8863

Browse files
mitatorvalds
authored andcommitted
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>
1 parent e501f29 commit f7b8863

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

fs/libfs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -822,7 +822,7 @@ ssize_t simple_attr_write(struct file *file, const char __user *buf,
822822
goto out;
823823

824824
attr->set_buf[size] = '\0';
825-
val = simple_strtol(attr->set_buf, NULL, 0);
825+
val = simple_strtoll(attr->set_buf, NULL, 0);
826826
ret = attr->set(attr->data, val);
827827
if (ret == 0)
828828
ret = len; /* on success, claim we got the whole input */

0 commit comments

Comments
 (0)