Skip to content
  • Wu Fengguang's avatar
    sysdev: fix prototype for memory_sysdev_class show/store functions · 8ff410da
    Wu Fengguang authored
    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 4a0b2b4d
    
    .
    
    Signed-off-by: default avatarWu 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: default avatarAndrew Morton <akpm@linux-foundation.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    8ff410da