• Heiko Carstens's avatar
    fs: change sys_truncate length parameter type · 4fd8da8d
    Heiko Carstens authored
    For this system call user space passes a signed long length parameter,
    while the kernel side takes an unsigned long parameter and converts it
    later to signed long again.
    
    This has led to bugs in compat wrappers see e.g.  dd90bbd5 "powerpc: Add
    compat_sys_truncate".  The s390 compat wrapper for this functions is
    broken as well since it also performs zero extension instead of sign
    extension for the length parameter.
    
    In addition if hpa comes up with an automated way of generating
    compat wrappers it would generate a wrong one here.
    
    So change the length parameter from unsigned long to long.
    
    Cc: "H. Peter Anvin" <hpa@zytor.com>
    Cc: Al Viro <viro@zeniv.linux.org.uk>
    Cc: Christoph Hellwig <hch@lst.de>
    Signed-off-by: default avatarHeiko Carstens <heiko.carstens@de.ibm.com>
    Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    4fd8da8d
open.c 27 KB