• Arnd Bergmann's avatar
    ksmbd: avoid field overflow warning · 9cedc58b
    Arnd Bergmann authored
    clang warns about a possible field overflow in a memcpy:
    
    In file included from fs/smb/server/smb_common.c:7:
    include/linux/fortify-string.h:583:4: error: call to '__write_overflow_field' declared with 'warning' attribute: detected write beyond size of field (1st parameter); maybe use struct_group()? [-Werror,-Wattribute-warning]
                            __write_overflow_field(p_size_field, size);
    
    It appears to interpret the "&out[baselen + 4]" as referring to a single
    byte of the character array, while the equivalen "out + baselen + 4" is
    seen as an offset into the array.
    
    I don't see that kind of warning elsewhere, so just go with the simple
    rework.
    
    Fixes: e2f34481 ("cifsd: add server-side procedures for SMB3")
    Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
    Acked-by: default avatarNamjae Jeon <linkinjeon@kernel.org>
    Signed-off-by: default avatarSteve French <stfrench@microsoft.com>
    9cedc58b
smb_common.c 18 KB