Skip to content
  • Arnd Bergmann's avatar
    lib/ubsan.c: fix gcc-10 warnings · 469cbd01
    Arnd Bergmann authored
    
    
    The latest compiler expects slightly different function prototypes
    for the ubsan helpers:
    
      lib/ubsan.c:192:6: error: conflicting types for built-in function '__ubsan_handle_add_overflow'; expected 'void(void *, void *, void *)' [-Werror=builtin-declaration-mismatch]
        192 | void __ubsan_handle_add_overflow(struct overflow_data *data,
            |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~
      lib/ubsan.c:200:6: error: conflicting types for built-in function '__ubsan_handle_sub_overflow'; expected 'void(void *, void *, void *)' [-Werror=builtin-declaration-mismatch]
        200 | void __ubsan_handle_sub_overflow(struct overflow_data *data,
            |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~
      lib/ubsan.c:207:6: error: conflicting types for built-in function '__ubsan_handle_mul_overflow'; expected 'void(void *, void *, void *)' [-Werror=builtin-declaration-mismatch]
        207 | void __ubsan_handle_mul_overflow(struct overflow_data *data,
            |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~
      lib/ubsan.c:214:6: error: conflicting types for built-in function '__ubsan_handle_negate_overflow'; expected 'void(void *, void *)' [-Werror=builtin-declaration-mismatch]
        214 | void __ubsan_handle_negate_overflow(struct overflow_data *data,
            |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      lib/ubsan.c:234:6: error: conflicting types for built-in function '__ubsan_handle_divrem_overflow'; expected 'void(void *, void *, void *)' [-Werror=builtin-declaration-mismatch]
        234 | void __ubsan_handle_divrem_overflow(struct overflow_data *data,
            |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    Change the Linux implementation to match these, using a local typed
    pointer.
    
    Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
    Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
    Reviewed-by: default avatarKees Cook <keescook@chromium.org>
    Cc: Andrey Ryabinin <aryabinin@virtuozzo.com>
    Cc: Herbert Xu <herbert@gondor.apana.org.au>
    Cc: Julien Grall <julien.grall@arm.com>
    Link: http://lkml.kernel.org/r/20200429185948.4189600-1-arnd@arndb.de
    
    
    Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    469cbd01