Re: [PATCH] err.h: add type checking to IS_ERR_VALUE macro

From: Andrzej Hajda
Date: Fri Dec 18 2015 - 09:02:53 EST


Hi kbuild test robot,

Thanks for tests :)

Log below shows there are IS_ERR_VALUE usage bugs present in the kernel,
which SmPL patch did not detected.
These bugs should be fixed before accepting current version of my patch.
If alternative version will be chosen, 'bugs' should become valid code.

Regards
Andrzej

On 12/18/2015 12:22 PM, kbuild test robot wrote:
> Hi Andrzej,
>
> [auto build test WARNING on v4.4-rc5]
> [also build test WARNING on next-20151217]
>
> url: https://github.com/0day-ci/linux/commits/Andrzej-Hajda/err-h-add-type-checking-to-IS_ERR_VALUE-macro/20151218-185839
> config: m68k-sun3_defconfig (attached as .config)
> reproduce:
> wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
> chmod +x ~/bin/make.cross
> # save the attached .config to linux build tree
> make.cross ARCH=m68k
>
> All warnings (new ones prefixed by >>):
>
> In file included from include/uapi/linux/stddef.h:1:0,
> from include/linux/stddef.h:4,
> from include/uapi/linux/posix_types.h:4,
> from include/uapi/linux/types.h:13,
> from include/linux/types.h:5,
> from include/uapi/linux/sysinfo.h:4,
> from include/uapi/linux/kernel.h:4,
> from include/linux/cache.h:4,
> from net/ipv4/netfilter/ip_tables.c:13:
> In function 'find_check_entry.isra.12',
> inlined from 'translate_table' at net/ipv4/netfilter/ip_tables.c:868:7:
> include/linux/compiler.h:484:38: error: call to '__compiletime_assert_674' declared with attribute error: Invalid IS_ERR_VALUE argument type
> _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
> ^
> include/linux/compiler.h:467:4: note: in definition of macro '__compiletime_assert'
> prefix ## suffix(); \
> ^
> include/linux/compiler.h:484:2: note: in expansion of macro '_compiletime_assert'
> _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
> ^
> include/linux/bug.h:50:37: note: in expansion of macro 'compiletime_assert'
> #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
> ^
> include/linux/err.h:24:5: note: in expansion of macro 'BUILD_BUG_ON_MSG'
> BUILD_BUG_ON_MSG((typeof(x))(-MAX_ERRNO) != (unsigned long)-MAX_ERRNO, "Invalid IS_ERR_VALUE argument type");\
> ^
>>> net/ipv4/netfilter/ip_tables.c:674:6: note: in expansion of macro 'IS_ERR_VALUE'
> if (IS_ERR_VALUE(e->counters.pcnt))
> ^
> --
> In file included from include/linux/linkage.h:4:0,
> from include/linux/kernel.h:6,
> from net/ipv4/netfilter/arp_tables.c:13:
> In function 'find_check_entry.isra.14',
> inlined from 'translate_table' at net/ipv4/netfilter/arp_tables.c:702:7:
> include/linux/compiler.h:484:38: error: call to '__compiletime_assert_530' declared with attribute error: Invalid IS_ERR_VALUE argument type
> _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
> ^
> include/linux/compiler.h:467:4: note: in definition of macro '__compiletime_assert'
> prefix ## suffix(); \
> ^
> include/linux/compiler.h:484:2: note: in expansion of macro '_compiletime_assert'
> _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
> ^
> include/linux/bug.h:50:37: note: in expansion of macro 'compiletime_assert'
> #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
> ^
> include/linux/err.h:24:5: note: in expansion of macro 'BUILD_BUG_ON_MSG'
> BUILD_BUG_ON_MSG((typeof(x))(-MAX_ERRNO) != (unsigned long)-MAX_ERRNO, "Invalid IS_ERR_VALUE argument type");\
> ^
>>> net/ipv4/netfilter/arp_tables.c:530:6: note: in expansion of macro 'IS_ERR_VALUE'
> if (IS_ERR_VALUE(e->counters.pcnt))
> ^
> --
> In file included from include/linux/linkage.h:4:0,
> from include/linux/kernel.h:6,
> from net/ipv6/netfilter/ip6_tables.c:15:
> In function 'find_check_entry.isra.12',
> inlined from 'translate_table' at net/ipv6/netfilter/ip6_tables.c:880:7:
> include/linux/compiler.h:484:38: error: call to '__compiletime_assert_687' declared with attribute error: Invalid IS_ERR_VALUE argument type
> _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
> ^
> include/linux/compiler.h:467:4: note: in definition of macro '__compiletime_assert'
> prefix ## suffix(); \
> ^
> include/linux/compiler.h:484:2: note: in expansion of macro '_compiletime_assert'
> _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
> ^
> include/linux/bug.h:50:37: note: in expansion of macro 'compiletime_assert'
> #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
> ^
> include/linux/err.h:24:5: note: in expansion of macro 'BUILD_BUG_ON_MSG'
> BUILD_BUG_ON_MSG((typeof(x))(-MAX_ERRNO) != (unsigned long)-MAX_ERRNO, "Invalid IS_ERR_VALUE argument type");\
> ^
>>> net/ipv6/netfilter/ip6_tables.c:687:6: note: in expansion of macro 'IS_ERR_VALUE'
> if (IS_ERR_VALUE(e->counters.pcnt))
> ^
>
> vim +/IS_ERR_VALUE +674 net/ipv4/netfilter/ip_tables.c
>
> 022748a9 Denys Vlasenko 2008-01-14 658 static int
> a83d8e8d Alexey Dobriyan 2010-01-18 659 find_check_entry(struct ipt_entry *e, struct net *net, const char *name,
> 0559518b Jan Engelhardt 2010-02-24 660 unsigned int size)
> ^1da177e Linus Torvalds 2005-04-16 661 {
> 87a2e70d Jan Engelhardt 2010-10-13 662 struct xt_entry_target *t;
> 6709dbbb Jan Engelhardt 2007-02-07 663 struct xt_target *target;
> ^1da177e Linus Torvalds 2005-04-16 664 int ret;
> ^1da177e Linus Torvalds 2005-04-16 665 unsigned int j;
> 9b4fce7a Jan Engelhardt 2008-10-08 666 struct xt_mtchk_param mtpar;
> dcea992a Jan Engelhardt 2010-02-24 667 struct xt_entry_match *ematch;
> ^1da177e Linus Torvalds 2005-04-16 668
> a96be246 Dmitry Mishin 2006-12-12 669 ret = check_entry(e, name);
> a96be246 Dmitry Mishin 2006-12-12 670 if (ret)
> a96be246 Dmitry Mishin 2006-12-12 671 return ret;
> 590bdf7f Dmitry Mishin 2006-10-30 672
> 71ae0dff Florian Westphal 2015-06-11 673 e->counters.pcnt = xt_percpu_counter_alloc();
> 71ae0dff Florian Westphal 2015-06-11 @674 if (IS_ERR_VALUE(e->counters.pcnt))
> 71ae0dff Florian Westphal 2015-06-11 675 return -ENOMEM;
> 71ae0dff Florian Westphal 2015-06-11 676
> ^1da177e Linus Torvalds 2005-04-16 677 j = 0;
> a83d8e8d Alexey Dobriyan 2010-01-18 678 mtpar.net = net;
> 9b4fce7a Jan Engelhardt 2008-10-08 679 mtpar.table = name;
> 9b4fce7a Jan Engelhardt 2008-10-08 680 mtpar.entryinfo = &e->ip;
> 9b4fce7a Jan Engelhardt 2008-10-08 681 mtpar.hook_mask = e->comefrom;
> 916a917d Jan Engelhardt 2008-10-08 682 mtpar.family = NFPROTO_IPV4;
>
> :::::: The code at line 674 was first introduced by commit
> :::::: 71ae0dff02d756e4d2ca710b79f2ff5390029a5f netfilter: xtables: use percpu rule counters
>
> :::::: TO: Florian Westphal <fw@xxxxxxxxx>
> :::::: CC: Pablo Neira Ayuso <pablo@xxxxxxxxxxxxx>
>
> ---
> 0-DAY kernel test infrastructure Open Source Technology Center
> https://lists.01.org/pipermail/kbuild-all Intel Corporation

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/