diff -urpN linux-2.6.19-rc2-mm2.sysfs/fs/sysfs/file.c 2-sysfs_write_file-string/fs/sysfs/file.c --- linux-2.6.19-rc2-mm2.sysfs/fs/sysfs/file.c 2006-10-22 18:38:47.000000000 +0200 +++ 2-sysfs_write_file-string/fs/sysfs/file.c 2006-10-22 18:45:38.000000000 +0200 @@ -195,6 +195,9 @@ fill_write_buffer(struct sysfs_buffer * 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; }