Skip to content
  • Arnd Bergmann's avatar
    crypto: atmel - fix 64-bit build warnings · 4c147bcf
    Arnd Bergmann authored
    
    
    When we enable COMPILE_TEST building for the Atmel sha and tdes implementations,
    we run into a couple of warnings about incorrect format strings, e.g.
    
    In file included from include/linux/platform_device.h:14:0,
                     from drivers/crypto/atmel-sha.c:24:
    drivers/crypto/atmel-sha.c: In function 'atmel_sha_xmit_cpu':
    drivers/crypto/atmel-sha.c:571:19: error: format '%d' expects argument of type 'int', but argument 6 has type 'size_t {aka long unsigned int}' [-Werror=format=]
    In file included from include/linux/printk.h:6:0,
                     from include/linux/kernel.h:13,
                     from drivers/crypto/atmel-tdes.c:17:
    drivers/crypto/atmel-tdes.c: In function 'atmel_tdes_crypt_dma_stop':
    include/linux/kern_levels.h:4:18: error: format '%u' expects argument of type 'unsigned int', but argument 2 has type 'size_t {aka long unsigned int}' [-Werror=format=]
    
    These are all fixed by using the "%z" modifier for size_t data.
    
    There are also a few uses of min()/max() with incompatible types:
    
    drivers/crypto/atmel-tdes.c: In function 'atmel_tdes_crypt_start':
    drivers/crypto/atmel-tdes.c:528:181: error: comparison of distinct pointer types lacks a cast [-Werror]
    
    Where possible, we should use consistent types here, otherwise we can use
    min_t()/max_t() to get well-defined behavior without a warning.
    
    Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
    Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
    4c147bcf