sysdev: fix prototype for memory_sysdev_class show/store functions
authorWu Fengguang <fengguang.wu@intel.com>
Sat, 16 Jan 2010 01:01:32 +0000 (17:01 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Sat, 16 Jan 2010 20:15:39 +0000 (12:15 -0800)
commit8ff410daa009c4b44be445ded5b0cec00abc0426
treec8cd0a20b7116e7f150397d50b25fc626bec86dd
parentba168fc37dea145deeb8fa9e7e71c748d2e00d74
sysdev: fix prototype for memory_sysdev_class show/store functions

The function prototype mismatches in call stack:

                [<ffffffff81494268>] print_block_size+0x58/0x60
                [<ffffffff81487e3f>] sysdev_class_show+0x1f/0x30
                [<ffffffff811d629b>] sysfs_read_file+0xcb/0x1f0
                [<ffffffff81176328>] vfs_read+0xc8/0x180

Due to prototype mismatch, print_block_size() will sprintf() into
*attribute instead of *buf, hence user space will read the initial
zeros from *buf:
$ hexdump /sys/devices/system/memory/block_size_bytes
0000000 0000 0000 0000 0000
0000008

After patch:
cat /sys/devices/system/memory/block_size_bytes
0x8000000

This complements commits c29af9636 and 4a0b2b4dbe.

Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>
Cc: Andi Kleen <andi@firstfloor.org>
Cc: Greg Kroah-Hartman <gregkh@suse.de>
Cc: "Zheng, Shaohui" <shaohui.zheng@intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
drivers/base/memory.c