* [dsahern-linux:nexthops/del-group-03 4/7] net/ipv4/fib_trie.c:1575 fib_table_lookup() error: uninitialized symbol 'nhsel'.
@ 2020-05-22 17:49 kbuild test robot
0 siblings, 0 replies; 3+ messages in thread
From: kbuild test robot @ 2020-05-22 17:49 UTC (permalink / raw)
To: kbuild
[-- Attachment #1: Type: text/plain, Size: 15875 bytes --]
CC: kbuild-all(a)lists.01.org
TO: David Ahern <dsahern@gmail.com>
tree: https://github.com/dsahern/linux nexthops/del-group-03
head: b8c06bc47e0a04603de20861b8d5f7291ff0bc12
commit: 063512a047f24cd25298dbb37ae1247a407dbdde [4/7] ipv4: Refactor nhc evaluation in fib_table_lookup
:::::: branch date: 19 hours ago
:::::: commit date: 20 hours ago
config: x86_64-defconfig (attached as .config)
compiler: gcc-7 (Ubuntu 7.5.0-6ubuntu2) 7.5.0
reproduce (this is a W=1 build):
git checkout 063512a047f24cd25298dbb37ae1247a407dbdde
# save the attached .config to linux build tree
make ARCH=x86_64
If you fix the issue, kindly add following tag as appropriate
Reported-by: kbuild test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
New smatch warnings:
net/ipv4/fib_trie.c:1575 fib_table_lookup() error: uninitialized symbol 'nhsel'.
Old smatch warnings:
net/ipv4/fib_trie.c:1454 fib_table_lookup() warn: potential spectre issue 'n->tnode' [w] (local cap)
net/ipv4/fib_trie.c:1454 fib_table_lookup() warn: possible spectre second half. '__u.__val'
net/ipv4/fib_trie.c:1515 fib_table_lookup() warn: potential spectre issue 'pn->tnode' [r]
# https://github.com/dsahern/linux/commit/063512a047f24cd25298dbb37ae1247a407dbdde
git remote add dsahern-linux https://github.com/dsahern/linux
git remote update dsahern-linux
git checkout 063512a047f24cd25298dbb37ae1247a407dbdde
vim +/nhsel +1575 net/ipv4/fib_trie.c
19baf839ff4a8d Robert Olsson 2005-06-21 1420
9f9e636d4f89f7 Alexander Duyck 2014-12-31 1421 /* Step 1: Travel to the longest prefix match in the trie */
9f9e636d4f89f7 Alexander Duyck 2014-12-31 1422 for (;;) {
88bae7149a5e98 Alexander Duyck 2015-03-06 1423 index = get_cindex(key, n);
9f9e636d4f89f7 Alexander Duyck 2014-12-31 1424
9f9e636d4f89f7 Alexander Duyck 2014-12-31 1425 /* This bit of code is a bit tricky but it combines multiple
9f9e636d4f89f7 Alexander Duyck 2014-12-31 1426 * checks into a single check. The prefix consists of the
9f9e636d4f89f7 Alexander Duyck 2014-12-31 1427 * prefix plus zeros for the "bits" in the prefix. The index
9f9e636d4f89f7 Alexander Duyck 2014-12-31 1428 * is the difference between the key and this value. From
9f9e636d4f89f7 Alexander Duyck 2014-12-31 1429 * this we can actually derive several pieces of data.
71e8b67d0fdd2f Alexander Duyck 2015-03-04 1430 * if (index >= (1ul << bits))
9f9e636d4f89f7 Alexander Duyck 2014-12-31 1431 * we have a mismatch in skip bits and failed
b3832117b4b613 Alexander Duyck 2015-01-22 1432 * else
b3832117b4b613 Alexander Duyck 2015-01-22 1433 * we know the value is cindex
71e8b67d0fdd2f Alexander Duyck 2015-03-04 1434 *
71e8b67d0fdd2f Alexander Duyck 2015-03-04 1435 * This check is safe even if bits == KEYLENGTH due to the
71e8b67d0fdd2f Alexander Duyck 2015-03-04 1436 * fact that we can only allocate a node with 32 bits if a
71e8b67d0fdd2f Alexander Duyck 2015-03-04 1437 * long is greater than 32 bits.
9f9e636d4f89f7 Alexander Duyck 2014-12-31 1438 */
71e8b67d0fdd2f Alexander Duyck 2015-03-04 1439 if (index >= (1ul << n->bits))
9f9e636d4f89f7 Alexander Duyck 2014-12-31 1440 break;
19baf839ff4a8d Robert Olsson 2005-06-21 1441
9f9e636d4f89f7 Alexander Duyck 2014-12-31 1442 /* we have found a leaf. Prefixes have already been compared */
9f9e636d4f89f7 Alexander Duyck 2014-12-31 1443 if (IS_LEAF(n))
a07f5f508a4d97 Stephen Hemminger 2008-01-22 1444 goto found;
19baf839ff4a8d Robert Olsson 2005-06-21 1445
9f9e636d4f89f7 Alexander Duyck 2014-12-31 1446 /* only record pn and cindex if we are going to be chopping
9f9e636d4f89f7 Alexander Duyck 2014-12-31 1447 * bits later. Otherwise we are just wasting cycles.
19baf839ff4a8d Robert Olsson 2005-06-21 1448 */
5405afd1a30620 Alexander Duyck 2014-12-31 1449 if (n->slen > n->pos) {
9f9e636d4f89f7 Alexander Duyck 2014-12-31 1450 pn = n;
9f9e636d4f89f7 Alexander Duyck 2014-12-31 1451 cindex = index;
9f9e636d4f89f7 Alexander Duyck 2014-12-31 1452 }
19baf839ff4a8d Robert Olsson 2005-06-21 1453
754baf8decce72 Alexander Duyck 2015-03-06 1454 n = get_child_rcu(n, index);
9f9e636d4f89f7 Alexander Duyck 2014-12-31 1455 if (unlikely(!n))
19baf839ff4a8d Robert Olsson 2005-06-21 1456 goto backtrace;
19baf839ff4a8d Robert Olsson 2005-06-21 1457 }
19baf839ff4a8d Robert Olsson 2005-06-21 1458
9f9e636d4f89f7 Alexander Duyck 2014-12-31 1459 /* Step 2: Sort out leaves and begin backtracing for longest prefix */
9f9e636d4f89f7 Alexander Duyck 2014-12-31 1460 for (;;) {
9f9e636d4f89f7 Alexander Duyck 2014-12-31 1461 /* record the pointer where our next node pointer is stored */
35c6edac197fcf Alexander Duyck 2015-03-06 1462 struct key_vector __rcu **cptr = n->tnode;
19baf839ff4a8d Robert Olsson 2005-06-21 1463
9f9e636d4f89f7 Alexander Duyck 2014-12-31 1464 /* This test verifies that none of the bits that differ
9f9e636d4f89f7 Alexander Duyck 2014-12-31 1465 * between the key and the prefix exist in the region of
9f9e636d4f89f7 Alexander Duyck 2014-12-31 1466 * the lsb and higher in the prefix.
19baf839ff4a8d Robert Olsson 2005-06-21 1467 */
5405afd1a30620 Alexander Duyck 2014-12-31 1468 if (unlikely(prefix_mismatch(key, n)) || (n->slen == n->pos))
19baf839ff4a8d Robert Olsson 2005-06-21 1469 goto backtrace;
19baf839ff4a8d Robert Olsson 2005-06-21 1470
9f9e636d4f89f7 Alexander Duyck 2014-12-31 1471 /* exit out and process leaf */
9f9e636d4f89f7 Alexander Duyck 2014-12-31 1472 if (unlikely(IS_LEAF(n)))
9f9e636d4f89f7 Alexander Duyck 2014-12-31 1473 break;
a07f5f508a4d97 Stephen Hemminger 2008-01-22 1474
9f9e636d4f89f7 Alexander Duyck 2014-12-31 1475 /* Don't bother recording parent info. Since we are in
9f9e636d4f89f7 Alexander Duyck 2014-12-31 1476 * prefix match mode we will have to come back to wherever
9f9e636d4f89f7 Alexander Duyck 2014-12-31 1477 * we started this traversal anyway
9f9e636d4f89f7 Alexander Duyck 2014-12-31 1478 */
91b9a277fc4d20 Olof Johansson 2005-08-09 1479
9f9e636d4f89f7 Alexander Duyck 2014-12-31 1480 while ((n = rcu_dereference(*cptr)) == NULL) {
19baf839ff4a8d Robert Olsson 2005-06-21 1481 backtrace:
9f9e636d4f89f7 Alexander Duyck 2014-12-31 1482 #ifdef CONFIG_IP_FIB_TRIE_STATS
9f9e636d4f89f7 Alexander Duyck 2014-12-31 1483 if (!n)
9f9e636d4f89f7 Alexander Duyck 2014-12-31 1484 this_cpu_inc(stats->null_node_hit);
9f9e636d4f89f7 Alexander Duyck 2014-12-31 1485 #endif
9f9e636d4f89f7 Alexander Duyck 2014-12-31 1486 /* If we are at cindex 0 there are no more bits for
9f9e636d4f89f7 Alexander Duyck 2014-12-31 1487 * us to strip at this level so we must ascend back
9f9e636d4f89f7 Alexander Duyck 2014-12-31 1488 * up one level to see if there are any more bits to
9f9e636d4f89f7 Alexander Duyck 2014-12-31 1489 * be stripped there.
19baf839ff4a8d Robert Olsson 2005-06-21 1490 */
9f9e636d4f89f7 Alexander Duyck 2014-12-31 1491 while (!cindex) {
9f9e636d4f89f7 Alexander Duyck 2014-12-31 1492 t_key pkey = pn->key;
19baf839ff4a8d Robert Olsson 2005-06-21 1493
88bae7149a5e98 Alexander Duyck 2015-03-06 1494 /* If we don't have a parent then there is
88bae7149a5e98 Alexander Duyck 2015-03-06 1495 * nothing for us to do as we do not have any
88bae7149a5e98 Alexander Duyck 2015-03-06 1496 * further nodes to parse.
88bae7149a5e98 Alexander Duyck 2015-03-06 1497 */
9f323973c915d4 David Ahern 2018-05-23 1498 if (IS_TRIE(pn)) {
9f323973c915d4 David Ahern 2018-05-23 1499 trace_fib_table_lookup(tb->tb_id, flp,
9f323973c915d4 David Ahern 2018-05-23 1500 NULL, -EAGAIN);
345e9b54268ae0 Alexander Duyck 2014-12-31 1501 return -EAGAIN;
9f323973c915d4 David Ahern 2018-05-23 1502 }
19baf839ff4a8d Robert Olsson 2005-06-21 1503 #ifdef CONFIG_IP_FIB_TRIE_STATS
8274a97aa4c694 Alexander Duyck 2014-12-31 1504 this_cpu_inc(stats->backtrack);
19baf839ff4a8d Robert Olsson 2005-06-21 1505 #endif
9f9e636d4f89f7 Alexander Duyck 2014-12-31 1506 /* Get Child's index */
88bae7149a5e98 Alexander Duyck 2015-03-06 1507 pn = node_parent_rcu(pn);
9f9e636d4f89f7 Alexander Duyck 2014-12-31 1508 cindex = get_index(pkey, pn);
19baf839ff4a8d Robert Olsson 2005-06-21 1509 }
9f9e636d4f89f7 Alexander Duyck 2014-12-31 1510
9f9e636d4f89f7 Alexander Duyck 2014-12-31 1511 /* strip the least significant bit from the cindex */
9f9e636d4f89f7 Alexander Duyck 2014-12-31 1512 cindex &= cindex - 1;
9f9e636d4f89f7 Alexander Duyck 2014-12-31 1513
9f9e636d4f89f7 Alexander Duyck 2014-12-31 1514 /* grab pointer for next child node */
41b489fd6ce03e Alexander Duyck 2015-03-04 1515 cptr = &pn->tnode[cindex];
19baf839ff4a8d Robert Olsson 2005-06-21 1516 }
9f9e636d4f89f7 Alexander Duyck 2014-12-31 1517 }
9f9e636d4f89f7 Alexander Duyck 2014-12-31 1518
19baf839ff4a8d Robert Olsson 2005-06-21 1519 found:
71e8b67d0fdd2f Alexander Duyck 2015-03-04 1520 /* this line carries forward the xor from earlier in the function */
71e8b67d0fdd2f Alexander Duyck 2015-03-04 1521 index = key ^ n->key;
71e8b67d0fdd2f Alexander Duyck 2015-03-04 1522
9f9e636d4f89f7 Alexander Duyck 2014-12-31 1523 /* Step 3: Process the leaf, if that fails fall back to backtracing */
79e5ad2ceb0067 Alexander Duyck 2015-02-25 1524 hlist_for_each_entry_rcu(fa, &n->leaf, fa_list) {
345e9b54268ae0 Alexander Duyck 2014-12-31 1525 struct fib_info *fi = fa->fa_info;
063512a047f24c David Ahern 2020-05-21 1526 struct fib_nh_common *nhc;
345e9b54268ae0 Alexander Duyck 2014-12-31 1527 int nhsel, err;
345e9b54268ae0 Alexander Duyck 2014-12-31 1528
a5829f536b3d11 Alexander Duyck 2016-01-28 1529 if ((BITS_PER_LONG > KEYLENGTH) || (fa->fa_slen < KEYLENGTH)) {
a5829f536b3d11 Alexander Duyck 2016-01-28 1530 if (index >= (1ul << fa->fa_slen))
9b6ebad5c3a152 Alexander Duyck 2015-02-25 1531 continue;
a5829f536b3d11 Alexander Duyck 2016-01-28 1532 }
345e9b54268ae0 Alexander Duyck 2014-12-31 1533 if (fa->fa_tos && fa->fa_tos != flp->flowi4_tos)
345e9b54268ae0 Alexander Duyck 2014-12-31 1534 continue;
345e9b54268ae0 Alexander Duyck 2014-12-31 1535 if (fi->fib_dead)
345e9b54268ae0 Alexander Duyck 2014-12-31 1536 continue;
345e9b54268ae0 Alexander Duyck 2014-12-31 1537 if (fa->fa_info->fib_scope < flp->flowi4_scope)
345e9b54268ae0 Alexander Duyck 2014-12-31 1538 continue;
345e9b54268ae0 Alexander Duyck 2014-12-31 1539 fib_alias_accessed(fa);
345e9b54268ae0 Alexander Duyck 2014-12-31 1540 err = fib_props[fa->fa_type].error;
345e9b54268ae0 Alexander Duyck 2014-12-31 1541 if (unlikely(err < 0)) {
4c7e8084fd467d David Ahern 2019-06-03 1542 out_reject:
345e9b54268ae0 Alexander Duyck 2014-12-31 1543 #ifdef CONFIG_IP_FIB_TRIE_STATS
345e9b54268ae0 Alexander Duyck 2014-12-31 1544 this_cpu_inc(stats->semantic_match_passed);
345e9b54268ae0 Alexander Duyck 2014-12-31 1545 #endif
9f323973c915d4 David Ahern 2018-05-23 1546 trace_fib_table_lookup(tb->tb_id, flp, NULL, err);
345e9b54268ae0 Alexander Duyck 2014-12-31 1547 return err;
345e9b54268ae0 Alexander Duyck 2014-12-31 1548 }
345e9b54268ae0 Alexander Duyck 2014-12-31 1549 if (fi->fib_flags & RTNH_F_DEAD)
345e9b54268ae0 Alexander Duyck 2014-12-31 1550 continue;
4c7e8084fd467d David Ahern 2019-06-03 1551
063512a047f24c David Ahern 2020-05-21 1552 if (unlikely(fi->nh)) {
063512a047f24c David Ahern 2020-05-21 1553 if (nexthop_is_blackhole(fi->nh)) {
4c7e8084fd467d David Ahern 2019-06-03 1554 err = fib_props[RTN_BLACKHOLE].error;
4c7e8084fd467d David Ahern 2019-06-03 1555 goto out_reject;
4c7e8084fd467d David Ahern 2019-06-03 1556 }
4c7e8084fd467d David Ahern 2019-06-03 1557
063512a047f24c David Ahern 2020-05-21 1558 nhc = nexthop_get_nhc_lookup(fi->nh, fib_flags, flp);
063512a047f24c David Ahern 2020-05-21 1559 if (nhc)
063512a047f24c David Ahern 2020-05-21 1560 goto set_result;
063512a047f24c David Ahern 2020-05-21 1561 goto miss;
063512a047f24c David Ahern 2020-05-21 1562 }
063512a047f24c David Ahern 2020-05-21 1563
5481d73f81549e David Ahern 2019-06-03 1564 for (nhsel = 0; nhsel < fib_info_num_path(fi); nhsel++) {
063512a047f24c David Ahern 2020-05-21 1565 nhc = fib_info_nhc(fi, nhsel);
345e9b54268ae0 Alexander Duyck 2014-12-31 1566
063512a047f24c David Ahern 2020-05-21 1567 if (!fib_lookup_good_nhc(nhc, fib_flags, flp))
345e9b54268ae0 Alexander Duyck 2014-12-31 1568 continue;
063512a047f24c David Ahern 2020-05-21 1569 set_result:
345e9b54268ae0 Alexander Duyck 2014-12-31 1570 if (!(fib_flags & FIB_LOOKUP_NOREF))
0029c0deb590bc Reshetova, Elena 2017-07-04 1571 refcount_inc(&fi->fib_clntref);
345e9b54268ae0 Alexander Duyck 2014-12-31 1572
6ffd903415320d David Ahern 2017-05-25 1573 res->prefix = htonl(n->key);
9b6ebad5c3a152 Alexander Duyck 2015-02-25 1574 res->prefixlen = KEYLENGTH - fa->fa_slen;
345e9b54268ae0 Alexander Duyck 2014-12-31 @1575 res->nh_sel = nhsel;
eba618abacade7 David Ahern 2019-04-02 1576 res->nhc = nhc;
345e9b54268ae0 Alexander Duyck 2014-12-31 1577 res->type = fa->fa_type;
345e9b54268ae0 Alexander Duyck 2014-12-31 1578 res->scope = fi->fib_scope;
345e9b54268ae0 Alexander Duyck 2014-12-31 1579 res->fi = fi;
345e9b54268ae0 Alexander Duyck 2014-12-31 1580 res->table = tb;
79e5ad2ceb0067 Alexander Duyck 2015-02-25 1581 res->fa_head = &n->leaf;
345e9b54268ae0 Alexander Duyck 2014-12-31 1582 #ifdef CONFIG_IP_FIB_TRIE_STATS
345e9b54268ae0 Alexander Duyck 2014-12-31 1583 this_cpu_inc(stats->semantic_match_passed);
345e9b54268ae0 Alexander Duyck 2014-12-31 1584 #endif
eba618abacade7 David Ahern 2019-04-02 1585 trace_fib_table_lookup(tb->tb_id, flp, nhc, err);
f6d3c19274c74f David Ahern 2015-08-28 1586
345e9b54268ae0 Alexander Duyck 2014-12-31 1587 return err;
345e9b54268ae0 Alexander Duyck 2014-12-31 1588 }
345e9b54268ae0 Alexander Duyck 2014-12-31 1589 }
063512a047f24c David Ahern 2020-05-21 1590 miss:
345e9b54268ae0 Alexander Duyck 2014-12-31 1591 #ifdef CONFIG_IP_FIB_TRIE_STATS
345e9b54268ae0 Alexander Duyck 2014-12-31 1592 this_cpu_inc(stats->semantic_match_miss);
345e9b54268ae0 Alexander Duyck 2014-12-31 1593 #endif
9f9e636d4f89f7 Alexander Duyck 2014-12-31 1594 goto backtrace;
19baf839ff4a8d Robert Olsson 2005-06-21 1595 }
6fc01438a94702 Florian Westphal 2011-08-25 1596 EXPORT_SYMBOL_GPL(fib_table_lookup);
19baf839ff4a8d Robert Olsson 2005-06-21 1597
:::::: The code at line 1575 was first introduced by commit
:::::: 345e9b54268ae065520a7252c182d22ef4591718 fib_trie: Push rcu_read_lock/unlock to callers
:::::: TO: Alexander Duyck <alexander.h.duyck@redhat.com>
:::::: CC: David S. Miller <davem@davemloft.net>
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 29100 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* [dsahern-linux:nexthops/del-group-03 4/7] net/ipv4/fib_trie.c:1575 fib_table_lookup() error: uninitialized symbol 'nhsel'.
@ 2020-05-23 8:03 ` Dan Carpenter
0 siblings, 0 replies; 3+ messages in thread
From: Dan Carpenter @ 2020-05-23 8:03 UTC (permalink / raw)
To: kbuild
[-- Attachment #1: Type: text/plain, Size: 7526 bytes --]
tree: https://github.com/dsahern/linux nexthops/del-group-03
head: b8c06bc47e0a04603de20861b8d5f7291ff0bc12
commit: 063512a047f24cd25298dbb37ae1247a407dbdde [4/7] ipv4: Refactor nhc evaluation in fib_table_lookup
:::::: branch date: 19 hours ago
:::::: commit date: 20 hours ago
config: x86_64-defconfig (attached as .config)
compiler: gcc-7 (Ubuntu 7.5.0-6ubuntu2) 7.5.0
reproduce (this is a W=1 build):
git checkout 063512a047f24cd25298dbb37ae1247a407dbdde
# save the attached .config to linux build tree
make ARCH=x86_64
If you fix the issue, kindly add following tag as appropriate
Reported-by: kbuild test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
New smatch warnings:
net/ipv4/fib_trie.c:1575 fib_table_lookup() error: uninitialized symbol 'nhsel'.
# https://github.com/dsahern/linux/commit/063512a047f24cd25298dbb37ae1247a407dbdde
git remote add dsahern-linux https://github.com/dsahern/linux
git remote update dsahern-linux
git checkout 063512a047f24cd25298dbb37ae1247a407dbdde
vim +/nhsel +1575 net/ipv4/fib_trie.c
19baf839ff4a8d Robert Olsson 2005-06-21 1519 found:
71e8b67d0fdd2f Alexander Duyck 2015-03-04 1520 /* this line carries forward the xor from earlier in the function */
71e8b67d0fdd2f Alexander Duyck 2015-03-04 1521 index = key ^ n->key;
71e8b67d0fdd2f Alexander Duyck 2015-03-04 1522
9f9e636d4f89f7 Alexander Duyck 2014-12-31 1523 /* Step 3: Process the leaf, if that fails fall back to backtracing */
79e5ad2ceb0067 Alexander Duyck 2015-02-25 1524 hlist_for_each_entry_rcu(fa, &n->leaf, fa_list) {
345e9b54268ae0 Alexander Duyck 2014-12-31 1525 struct fib_info *fi = fa->fa_info;
063512a047f24c David Ahern 2020-05-21 1526 struct fib_nh_common *nhc;
345e9b54268ae0 Alexander Duyck 2014-12-31 1527 int nhsel, err;
^^^^^
345e9b54268ae0 Alexander Duyck 2014-12-31 1528
a5829f536b3d11 Alexander Duyck 2016-01-28 1529 if ((BITS_PER_LONG > KEYLENGTH) || (fa->fa_slen < KEYLENGTH)) {
a5829f536b3d11 Alexander Duyck 2016-01-28 1530 if (index >= (1ul << fa->fa_slen))
9b6ebad5c3a152 Alexander Duyck 2015-02-25 1531 continue;
a5829f536b3d11 Alexander Duyck 2016-01-28 1532 }
345e9b54268ae0 Alexander Duyck 2014-12-31 1533 if (fa->fa_tos && fa->fa_tos != flp->flowi4_tos)
345e9b54268ae0 Alexander Duyck 2014-12-31 1534 continue;
345e9b54268ae0 Alexander Duyck 2014-12-31 1535 if (fi->fib_dead)
345e9b54268ae0 Alexander Duyck 2014-12-31 1536 continue;
345e9b54268ae0 Alexander Duyck 2014-12-31 1537 if (fa->fa_info->fib_scope < flp->flowi4_scope)
345e9b54268ae0 Alexander Duyck 2014-12-31 1538 continue;
345e9b54268ae0 Alexander Duyck 2014-12-31 1539 fib_alias_accessed(fa);
345e9b54268ae0 Alexander Duyck 2014-12-31 1540 err = fib_props[fa->fa_type].error;
345e9b54268ae0 Alexander Duyck 2014-12-31 1541 if (unlikely(err < 0)) {
4c7e8084fd467d David Ahern 2019-06-03 1542 out_reject:
345e9b54268ae0 Alexander Duyck 2014-12-31 1543 #ifdef CONFIG_IP_FIB_TRIE_STATS
345e9b54268ae0 Alexander Duyck 2014-12-31 1544 this_cpu_inc(stats->semantic_match_passed);
345e9b54268ae0 Alexander Duyck 2014-12-31 1545 #endif
9f323973c915d4 David Ahern 2018-05-23 1546 trace_fib_table_lookup(tb->tb_id, flp, NULL, err);
345e9b54268ae0 Alexander Duyck 2014-12-31 1547 return err;
345e9b54268ae0 Alexander Duyck 2014-12-31 1548 }
345e9b54268ae0 Alexander Duyck 2014-12-31 1549 if (fi->fib_flags & RTNH_F_DEAD)
345e9b54268ae0 Alexander Duyck 2014-12-31 1550 continue;
4c7e8084fd467d David Ahern 2019-06-03 1551
063512a047f24c David Ahern 2020-05-21 1552 if (unlikely(fi->nh)) {
063512a047f24c David Ahern 2020-05-21 1553 if (nexthop_is_blackhole(fi->nh)) {
4c7e8084fd467d David Ahern 2019-06-03 1554 err = fib_props[RTN_BLACKHOLE].error;
4c7e8084fd467d David Ahern 2019-06-03 1555 goto out_reject;
4c7e8084fd467d David Ahern 2019-06-03 1556 }
4c7e8084fd467d David Ahern 2019-06-03 1557
063512a047f24c David Ahern 2020-05-21 1558 nhc = nexthop_get_nhc_lookup(fi->nh, fib_flags, flp);
063512a047f24c David Ahern 2020-05-21 1559 if (nhc)
063512a047f24c David Ahern 2020-05-21 1560 goto set_result;
^^^^^^^^^^^^^^^
goto
063512a047f24c David Ahern 2020-05-21 1561 goto miss;
063512a047f24c David Ahern 2020-05-21 1562 }
063512a047f24c David Ahern 2020-05-21 1563
5481d73f81549e David Ahern 2019-06-03 1564 for (nhsel = 0; nhsel < fib_info_num_path(fi); nhsel++) {
063512a047f24c David Ahern 2020-05-21 1565 nhc = fib_info_nhc(fi, nhsel);
345e9b54268ae0 Alexander Duyck 2014-12-31 1566
063512a047f24c David Ahern 2020-05-21 1567 if (!fib_lookup_good_nhc(nhc, fib_flags, flp))
345e9b54268ae0 Alexander Duyck 2014-12-31 1568 continue;
063512a047f24c David Ahern 2020-05-21 1569 set_result:
345e9b54268ae0 Alexander Duyck 2014-12-31 1570 if (!(fib_flags & FIB_LOOKUP_NOREF))
0029c0deb590bc Reshetova, Elena 2017-07-04 1571 refcount_inc(&fi->fib_clntref);
345e9b54268ae0 Alexander Duyck 2014-12-31 1572
6ffd903415320d David Ahern 2017-05-25 1573 res->prefix = htonl(n->key);
9b6ebad5c3a152 Alexander Duyck 2015-02-25 1574 res->prefixlen = KEYLENGTH - fa->fa_slen;
345e9b54268ae0 Alexander Duyck 2014-12-31 @1575 res->nh_sel = nhsel;
^^^^^^^^^^^^^^^^^^^
Uninitialized.
eba618abacade7 David Ahern 2019-04-02 1576 res->nhc = nhc;
345e9b54268ae0 Alexander Duyck 2014-12-31 1577 res->type = fa->fa_type;
345e9b54268ae0 Alexander Duyck 2014-12-31 1578 res->scope = fi->fib_scope;
345e9b54268ae0 Alexander Duyck 2014-12-31 1579 res->fi = fi;
345e9b54268ae0 Alexander Duyck 2014-12-31 1580 res->table = tb;
79e5ad2ceb0067 Alexander Duyck 2015-02-25 1581 res->fa_head = &n->leaf;
345e9b54268ae0 Alexander Duyck 2014-12-31 1582 #ifdef CONFIG_IP_FIB_TRIE_STATS
345e9b54268ae0 Alexander Duyck 2014-12-31 1583 this_cpu_inc(stats->semantic_match_passed);
345e9b54268ae0 Alexander Duyck 2014-12-31 1584 #endif
eba618abacade7 David Ahern 2019-04-02 1585 trace_fib_table_lookup(tb->tb_id, flp, nhc, err);
f6d3c19274c74f David Ahern 2015-08-28 1586
345e9b54268ae0 Alexander Duyck 2014-12-31 1587 return err;
345e9b54268ae0 Alexander Duyck 2014-12-31 1588 }
345e9b54268ae0 Alexander Duyck 2014-12-31 1589 }
063512a047f24c David Ahern 2020-05-21 1590 miss:
345e9b54268ae0 Alexander Duyck 2014-12-31 1591 #ifdef CONFIG_IP_FIB_TRIE_STATS
345e9b54268ae0 Alexander Duyck 2014-12-31 1592 this_cpu_inc(stats->semantic_match_miss);
345e9b54268ae0 Alexander Duyck 2014-12-31 1593 #endif
9f9e636d4f89f7 Alexander Duyck 2014-12-31 1594 goto backtrace;
19baf839ff4a8d Robert Olsson 2005-06-21 1595 }
6fc01438a94702 Florian Westphal 2011-08-25 1596 EXPORT_SYMBOL_GPL(fib_table_lookup);
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 29100 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* [dsahern-linux:nexthops/del-group-03 4/7] net/ipv4/fib_trie.c:1575 fib_table_lookup() error: uninitialized symbol 'nhsel'.
@ 2020-05-23 8:03 ` Dan Carpenter
0 siblings, 0 replies; 3+ messages in thread
From: Dan Carpenter @ 2020-05-23 8:03 UTC (permalink / raw)
To: kbuild-all
[-- Attachment #1: Type: text/plain, Size: 7526 bytes --]
tree: https://github.com/dsahern/linux nexthops/del-group-03
head: b8c06bc47e0a04603de20861b8d5f7291ff0bc12
commit: 063512a047f24cd25298dbb37ae1247a407dbdde [4/7] ipv4: Refactor nhc evaluation in fib_table_lookup
:::::: branch date: 19 hours ago
:::::: commit date: 20 hours ago
config: x86_64-defconfig (attached as .config)
compiler: gcc-7 (Ubuntu 7.5.0-6ubuntu2) 7.5.0
reproduce (this is a W=1 build):
git checkout 063512a047f24cd25298dbb37ae1247a407dbdde
# save the attached .config to linux build tree
make ARCH=x86_64
If you fix the issue, kindly add following tag as appropriate
Reported-by: kbuild test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
New smatch warnings:
net/ipv4/fib_trie.c:1575 fib_table_lookup() error: uninitialized symbol 'nhsel'.
# https://github.com/dsahern/linux/commit/063512a047f24cd25298dbb37ae1247a407dbdde
git remote add dsahern-linux https://github.com/dsahern/linux
git remote update dsahern-linux
git checkout 063512a047f24cd25298dbb37ae1247a407dbdde
vim +/nhsel +1575 net/ipv4/fib_trie.c
19baf839ff4a8d Robert Olsson 2005-06-21 1519 found:
71e8b67d0fdd2f Alexander Duyck 2015-03-04 1520 /* this line carries forward the xor from earlier in the function */
71e8b67d0fdd2f Alexander Duyck 2015-03-04 1521 index = key ^ n->key;
71e8b67d0fdd2f Alexander Duyck 2015-03-04 1522
9f9e636d4f89f7 Alexander Duyck 2014-12-31 1523 /* Step 3: Process the leaf, if that fails fall back to backtracing */
79e5ad2ceb0067 Alexander Duyck 2015-02-25 1524 hlist_for_each_entry_rcu(fa, &n->leaf, fa_list) {
345e9b54268ae0 Alexander Duyck 2014-12-31 1525 struct fib_info *fi = fa->fa_info;
063512a047f24c David Ahern 2020-05-21 1526 struct fib_nh_common *nhc;
345e9b54268ae0 Alexander Duyck 2014-12-31 1527 int nhsel, err;
^^^^^
345e9b54268ae0 Alexander Duyck 2014-12-31 1528
a5829f536b3d11 Alexander Duyck 2016-01-28 1529 if ((BITS_PER_LONG > KEYLENGTH) || (fa->fa_slen < KEYLENGTH)) {
a5829f536b3d11 Alexander Duyck 2016-01-28 1530 if (index >= (1ul << fa->fa_slen))
9b6ebad5c3a152 Alexander Duyck 2015-02-25 1531 continue;
a5829f536b3d11 Alexander Duyck 2016-01-28 1532 }
345e9b54268ae0 Alexander Duyck 2014-12-31 1533 if (fa->fa_tos && fa->fa_tos != flp->flowi4_tos)
345e9b54268ae0 Alexander Duyck 2014-12-31 1534 continue;
345e9b54268ae0 Alexander Duyck 2014-12-31 1535 if (fi->fib_dead)
345e9b54268ae0 Alexander Duyck 2014-12-31 1536 continue;
345e9b54268ae0 Alexander Duyck 2014-12-31 1537 if (fa->fa_info->fib_scope < flp->flowi4_scope)
345e9b54268ae0 Alexander Duyck 2014-12-31 1538 continue;
345e9b54268ae0 Alexander Duyck 2014-12-31 1539 fib_alias_accessed(fa);
345e9b54268ae0 Alexander Duyck 2014-12-31 1540 err = fib_props[fa->fa_type].error;
345e9b54268ae0 Alexander Duyck 2014-12-31 1541 if (unlikely(err < 0)) {
4c7e8084fd467d David Ahern 2019-06-03 1542 out_reject:
345e9b54268ae0 Alexander Duyck 2014-12-31 1543 #ifdef CONFIG_IP_FIB_TRIE_STATS
345e9b54268ae0 Alexander Duyck 2014-12-31 1544 this_cpu_inc(stats->semantic_match_passed);
345e9b54268ae0 Alexander Duyck 2014-12-31 1545 #endif
9f323973c915d4 David Ahern 2018-05-23 1546 trace_fib_table_lookup(tb->tb_id, flp, NULL, err);
345e9b54268ae0 Alexander Duyck 2014-12-31 1547 return err;
345e9b54268ae0 Alexander Duyck 2014-12-31 1548 }
345e9b54268ae0 Alexander Duyck 2014-12-31 1549 if (fi->fib_flags & RTNH_F_DEAD)
345e9b54268ae0 Alexander Duyck 2014-12-31 1550 continue;
4c7e8084fd467d David Ahern 2019-06-03 1551
063512a047f24c David Ahern 2020-05-21 1552 if (unlikely(fi->nh)) {
063512a047f24c David Ahern 2020-05-21 1553 if (nexthop_is_blackhole(fi->nh)) {
4c7e8084fd467d David Ahern 2019-06-03 1554 err = fib_props[RTN_BLACKHOLE].error;
4c7e8084fd467d David Ahern 2019-06-03 1555 goto out_reject;
4c7e8084fd467d David Ahern 2019-06-03 1556 }
4c7e8084fd467d David Ahern 2019-06-03 1557
063512a047f24c David Ahern 2020-05-21 1558 nhc = nexthop_get_nhc_lookup(fi->nh, fib_flags, flp);
063512a047f24c David Ahern 2020-05-21 1559 if (nhc)
063512a047f24c David Ahern 2020-05-21 1560 goto set_result;
^^^^^^^^^^^^^^^
goto
063512a047f24c David Ahern 2020-05-21 1561 goto miss;
063512a047f24c David Ahern 2020-05-21 1562 }
063512a047f24c David Ahern 2020-05-21 1563
5481d73f81549e David Ahern 2019-06-03 1564 for (nhsel = 0; nhsel < fib_info_num_path(fi); nhsel++) {
063512a047f24c David Ahern 2020-05-21 1565 nhc = fib_info_nhc(fi, nhsel);
345e9b54268ae0 Alexander Duyck 2014-12-31 1566
063512a047f24c David Ahern 2020-05-21 1567 if (!fib_lookup_good_nhc(nhc, fib_flags, flp))
345e9b54268ae0 Alexander Duyck 2014-12-31 1568 continue;
063512a047f24c David Ahern 2020-05-21 1569 set_result:
345e9b54268ae0 Alexander Duyck 2014-12-31 1570 if (!(fib_flags & FIB_LOOKUP_NOREF))
0029c0deb590bc Reshetova, Elena 2017-07-04 1571 refcount_inc(&fi->fib_clntref);
345e9b54268ae0 Alexander Duyck 2014-12-31 1572
6ffd903415320d David Ahern 2017-05-25 1573 res->prefix = htonl(n->key);
9b6ebad5c3a152 Alexander Duyck 2015-02-25 1574 res->prefixlen = KEYLENGTH - fa->fa_slen;
345e9b54268ae0 Alexander Duyck 2014-12-31 @1575 res->nh_sel = nhsel;
^^^^^^^^^^^^^^^^^^^
Uninitialized.
eba618abacade7 David Ahern 2019-04-02 1576 res->nhc = nhc;
345e9b54268ae0 Alexander Duyck 2014-12-31 1577 res->type = fa->fa_type;
345e9b54268ae0 Alexander Duyck 2014-12-31 1578 res->scope = fi->fib_scope;
345e9b54268ae0 Alexander Duyck 2014-12-31 1579 res->fi = fi;
345e9b54268ae0 Alexander Duyck 2014-12-31 1580 res->table = tb;
79e5ad2ceb0067 Alexander Duyck 2015-02-25 1581 res->fa_head = &n->leaf;
345e9b54268ae0 Alexander Duyck 2014-12-31 1582 #ifdef CONFIG_IP_FIB_TRIE_STATS
345e9b54268ae0 Alexander Duyck 2014-12-31 1583 this_cpu_inc(stats->semantic_match_passed);
345e9b54268ae0 Alexander Duyck 2014-12-31 1584 #endif
eba618abacade7 David Ahern 2019-04-02 1585 trace_fib_table_lookup(tb->tb_id, flp, nhc, err);
f6d3c19274c74f David Ahern 2015-08-28 1586
345e9b54268ae0 Alexander Duyck 2014-12-31 1587 return err;
345e9b54268ae0 Alexander Duyck 2014-12-31 1588 }
345e9b54268ae0 Alexander Duyck 2014-12-31 1589 }
063512a047f24c David Ahern 2020-05-21 1590 miss:
345e9b54268ae0 Alexander Duyck 2014-12-31 1591 #ifdef CONFIG_IP_FIB_TRIE_STATS
345e9b54268ae0 Alexander Duyck 2014-12-31 1592 this_cpu_inc(stats->semantic_match_miss);
345e9b54268ae0 Alexander Duyck 2014-12-31 1593 #endif
9f9e636d4f89f7 Alexander Duyck 2014-12-31 1594 goto backtrace;
19baf839ff4a8d Robert Olsson 2005-06-21 1595 }
6fc01438a94702 Florian Westphal 2011-08-25 1596 EXPORT_SYMBOL_GPL(fib_table_lookup);
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 29100 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-05-23 8:03 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-22 17:49 [dsahern-linux:nexthops/del-group-03 4/7] net/ipv4/fib_trie.c:1575 fib_table_lookup() error: uninitialized symbol 'nhsel' kbuild test robot
2020-05-23 8:03 Dan Carpenter
2020-05-23 8:03 ` Dan Carpenter
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.