Commit f7b88631 authored by Akinobu Mita's avatar Akinobu Mita Committed by Linus Torvalds

fs/libfs.c: fix simple_attr_write() on 32bit machines

Assume that /sys/kernel/debug/dummy64 is debugfs file created by

	# cd /sys/kernel/debug
	# echo 0x1234567812345678 > dummy64
	# cat dummy64

	# echo 0x80000000 > dummy64
	# cat dummy64

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: default avatarAkinobu Mita <>
Cc: Greg Kroah-Hartman <>
Signed-off-by: default avatarAndrew Morton <>
Signed-off-by: default avatarLinus Torvalds <>
parent e501f29c
......@@ -822,7 +822,7 @@ ssize_t simple_attr_write(struct file *file, const char __user *buf,
goto out;
attr->set_buf[size] = '\0';
val = simple_strtol(attr->set_buf, NULL, 0);
val = simple_strtoll(attr->set_buf, NULL, 0);
ret = attr->set(attr->data, val);
if (ret == 0)
ret = len; /* on success, claim we got the whole input */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment