• Arnd Bergmann's avatar
    ipv6: fix clang Wformat warning · 6ad2dd6c
    Arnd Bergmann authored
    When building with 'make W=1', clang warns about a mismatched
    format string:
    
    net/ipv6/ah6.c:710:4: error: format specifies type 'unsigned short' but the argument has type 'int' [-Werror,-Wformat]
                            aalg_desc->uinfo.auth.icv_fullbits/8);
                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    include/linux/printk.h:375:34: note: expanded from macro 'pr_info'
            printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__)
                                    ~~~     ^~~~~~~~~~~
    net/ipv6/esp6.c:1153:5: error: format specifies type 'unsigned short' but the argument has type 'int' [-Werror,-Wformat]
                                    aalg_desc->uinfo.auth.icv_fullbits / 8);
                                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    include/linux/printk.h:375:34: note: expanded from macro 'pr_info'
            printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__)
                                    ~~~     ^~~~~~~~~~~
    
    Here, the result of dividing a 16-bit number by a 32-bit number
    produces a 32-bit result, which is printed as a 16-bit integer.
    
    Change the %hu format to the normal %u, which has the same effect
    but avoids the warning.
    Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
    Signed-off-by: default avatarSteffen Klassert <steffen.klassert@secunet.com>
    6ad2dd6c
esp6.c 28.8 KB