• Arnd Bergmann's avatar
    netfilter: nf_tables: avoid uninitialized variable warning · d2e4d593
    Arnd Bergmann authored
    The newly added nft_range_eval() function handles the two possible
    nft range operations, but as the compiler warning points out,
    any unexpected value would lead to the 'mismatch' variable being
    used without being initialized:
    
    net/netfilter/nft_range.c: In function 'nft_range_eval':
    net/netfilter/nft_range.c:45:5: error: 'mismatch' may be used uninitialized in this function [-Werror=maybe-uninitialized]
    
    This removes the variable in question and instead moves the
    condition into the switch itself, which is potentially more
    efficient than adding a bogus 'default' clause as in my
    first approach, and is nicer than using the 'uninitialized_var'
    macro.
    
    Fixes: 0f3cd9b3 ("netfilter: nf_tables: add range expression")
    Link: http://patchwork.ozlabs.org/patch/677114/Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
    Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
    d2e4d593
nft_range.c 3.66 KB