From: kernel test robot <lkp@intel.com>
To: kbuild@lists.01.org
Subject: [mptcp:export 11/21] net/mptcp/pm_netlink.c:553 mptcp_pm_nl_append_new_local_addr() warn: impossible condition '(entry->addr.id > 255) => (0-255 > 255)'
Date: Thu, 17 Dec 2020 21:52:07 +0800 [thread overview]
Message-ID: <202012172103.a6OS1RJh-lkp@intel.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 5633 bytes --]
CC: kbuild-all(a)lists.01.org
CC: mptcp(a)lists.01.org
TO: Geliang Tang <geliangtang@gmail.com>
CC: Mat Martineau <mathew.j.martineau@linux.intel.com>
tree: https://github.com/multipath-tcp/mptcp_net-next.git export
head: 419ed13c1312e8901c526265e8f66dd8930732b8
commit: 737e2a42ce26bbd4839288d8cd1cfd9228f84018 [11/21] mptcp: add the address ID assignment bitmap
:::::: branch date: 5 hours ago
:::::: commit date: 5 hours ago
config: x86_64-randconfig-m001-20201217 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
New smatch warnings:
net/mptcp/pm_netlink.c:553 mptcp_pm_nl_append_new_local_addr() warn: impossible condition '(entry->addr.id > 255) => (0-255 > 255)'
Old smatch warnings:
net/mptcp/pm_netlink.c:560 mptcp_pm_nl_append_new_local_addr() warn: impossible condition '(entry->addr.id > 255) => (0-255 > 255)'
vim +553 net/mptcp/pm_netlink.c
01cacb00b35cb62 Paolo Abeni 2020-03-27 520
01cacb00b35cb62 Paolo Abeni 2020-03-27 521 static int mptcp_pm_nl_append_new_local_addr(struct pm_nl_pernet *pernet,
01cacb00b35cb62 Paolo Abeni 2020-03-27 522 struct mptcp_pm_addr_entry *entry)
01cacb00b35cb62 Paolo Abeni 2020-03-27 523 {
01cacb00b35cb62 Paolo Abeni 2020-03-27 524 struct mptcp_pm_addr_entry *cur;
01cacb00b35cb62 Paolo Abeni 2020-03-27 525 int ret = -EINVAL;
01cacb00b35cb62 Paolo Abeni 2020-03-27 526
01cacb00b35cb62 Paolo Abeni 2020-03-27 527 spin_lock_bh(&pernet->lock);
01cacb00b35cb62 Paolo Abeni 2020-03-27 528 /* to keep the code simple, don't do IDR-like allocation for address ID,
01cacb00b35cb62 Paolo Abeni 2020-03-27 529 * just bail when we exceed limits
01cacb00b35cb62 Paolo Abeni 2020-03-27 530 */
737e2a42ce26bbd Geliang Tang 2020-12-17 531 if (pernet->next_id == MAX_ADDR_ID)
737e2a42ce26bbd Geliang Tang 2020-12-17 532 pernet->next_id = 1;
01cacb00b35cb62 Paolo Abeni 2020-03-27 533 if (pernet->addrs >= MPTCP_PM_ADDR_MAX)
01cacb00b35cb62 Paolo Abeni 2020-03-27 534 goto out;
737e2a42ce26bbd Geliang Tang 2020-12-17 535 if (test_bit(entry->addr.id, pernet->id_bitmap))
737e2a42ce26bbd Geliang Tang 2020-12-17 536 goto out;
01cacb00b35cb62 Paolo Abeni 2020-03-27 537
01cacb00b35cb62 Paolo Abeni 2020-03-27 538 /* do not insert duplicate address, differentiate on port only
01cacb00b35cb62 Paolo Abeni 2020-03-27 539 * singled addresses
01cacb00b35cb62 Paolo Abeni 2020-03-27 540 */
01cacb00b35cb62 Paolo Abeni 2020-03-27 541 list_for_each_entry(cur, &pernet->local_addr_list, list) {
01cacb00b35cb62 Paolo Abeni 2020-03-27 542 if (addresses_equal(&cur->addr, &entry->addr,
01cacb00b35cb62 Paolo Abeni 2020-03-27 543 address_use_port(entry) &&
01cacb00b35cb62 Paolo Abeni 2020-03-27 544 address_use_port(cur)))
01cacb00b35cb62 Paolo Abeni 2020-03-27 545 goto out;
01cacb00b35cb62 Paolo Abeni 2020-03-27 546 }
01cacb00b35cb62 Paolo Abeni 2020-03-27 547
737e2a42ce26bbd Geliang Tang 2020-12-17 548 if (!entry->addr.id) {
737e2a42ce26bbd Geliang Tang 2020-12-17 549 find_next:
737e2a42ce26bbd Geliang Tang 2020-12-17 550 entry->addr.id = find_next_zero_bit(pernet->id_bitmap,
737e2a42ce26bbd Geliang Tang 2020-12-17 551 MAX_ADDR_ID + 1,
737e2a42ce26bbd Geliang Tang 2020-12-17 552 pernet->next_id);
737e2a42ce26bbd Geliang Tang 2020-12-17 @553 if ((!entry->addr.id || entry->addr.id > MAX_ADDR_ID) &&
737e2a42ce26bbd Geliang Tang 2020-12-17 554 pernet->next_id != 1) {
737e2a42ce26bbd Geliang Tang 2020-12-17 555 pernet->next_id = 1;
737e2a42ce26bbd Geliang Tang 2020-12-17 556 goto find_next;
737e2a42ce26bbd Geliang Tang 2020-12-17 557 }
737e2a42ce26bbd Geliang Tang 2020-12-17 558 }
737e2a42ce26bbd Geliang Tang 2020-12-17 559
737e2a42ce26bbd Geliang Tang 2020-12-17 560 if (!entry->addr.id || entry->addr.id > MAX_ADDR_ID)
737e2a42ce26bbd Geliang Tang 2020-12-17 561 goto out;
737e2a42ce26bbd Geliang Tang 2020-12-17 562
737e2a42ce26bbd Geliang Tang 2020-12-17 563 __set_bit(entry->addr.id, pernet->id_bitmap);
737e2a42ce26bbd Geliang Tang 2020-12-17 564 if (entry->addr.id > pernet->next_id)
737e2a42ce26bbd Geliang Tang 2020-12-17 565 pernet->next_id = entry->addr.id;
737e2a42ce26bbd Geliang Tang 2020-12-17 566
ef0da3b8a2f18f5 Paolo Abeni 2020-09-14 567 if (entry->addr.flags & MPTCP_PM_ADDR_FLAG_SIGNAL)
01cacb00b35cb62 Paolo Abeni 2020-03-27 568 pernet->add_addr_signal_max++;
ef0da3b8a2f18f5 Paolo Abeni 2020-09-14 569 if (entry->addr.flags & MPTCP_PM_ADDR_FLAG_SUBFLOW)
01cacb00b35cb62 Paolo Abeni 2020-03-27 570 pernet->local_addr_max++;
01cacb00b35cb62 Paolo Abeni 2020-03-27 571
01cacb00b35cb62 Paolo Abeni 2020-03-27 572 pernet->addrs++;
01cacb00b35cb62 Paolo Abeni 2020-03-27 573 list_add_tail_rcu(&entry->list, &pernet->local_addr_list);
01cacb00b35cb62 Paolo Abeni 2020-03-27 574 ret = entry->addr.id;
01cacb00b35cb62 Paolo Abeni 2020-03-27 575
01cacb00b35cb62 Paolo Abeni 2020-03-27 576 out:
01cacb00b35cb62 Paolo Abeni 2020-03-27 577 spin_unlock_bh(&pernet->lock);
01cacb00b35cb62 Paolo Abeni 2020-03-27 578 return ret;
01cacb00b35cb62 Paolo Abeni 2020-03-27 579 }
01cacb00b35cb62 Paolo Abeni 2020-03-27 580
---
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: 32634 bytes --]
reply other threads:[~2020-12-17 13:52 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=202012172103.a6OS1RJh-lkp@intel.com \
--to=lkp@intel.com \
--cc=kbuild@lists.01.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.