From: kernel test robot <lkp@intel.com>
To: oe-kbuild@lists.linux.dev
Cc: lkp@intel.com, Dan Carpenter <error27@gmail.com>
Subject: [net-next:main 37/39] drivers/net/dsa/mxl862xx/mxl862xx.c:942 mxl862xx_vf_del_vid() warn: iterator used outside loop: 'last_ve'
Date: Sat, 11 Apr 2026 15:24:40 +0800 [thread overview]
Message-ID: <202604111508.AZWFGSvb-lkp@intel.com> (raw)
BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
CC: netdev@vger.kernel.org
TO: Daniel Golle <daniel@makrotopia.org>
CC: Jakub Kicinski <kuba@kernel.org>
tree: https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git main
head: 3f3a2aefbc661b837c8e344f944982d61c2ae037
commit: d587f9b6dcc98c1e8aeb5c189a7bfac60d6d29ac [37/39] net: dsa: mxl862xx: implement VLAN functionality
:::::: branch date: 8 hours ago
:::::: commit date: 8 hours ago
config: x86_64-randconfig-161-20260411 (https://download.01.org/0day-ci/archive/20260411/202604111508.AZWFGSvb-lkp@intel.com/config)
compiler: gcc-14 (Debian 14.2.0-19) 14.2.0
smatch: v0.5.0-9004-gb810ac53
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Reported-by: Dan Carpenter <error27@gmail.com>
| Closes: https://lore.kernel.org/r/202604111508.AZWFGSvb-lkp@intel.com/
smatch warnings:
drivers/net/dsa/mxl862xx/mxl862xx.c:942 mxl862xx_vf_del_vid() warn: iterator used outside loop: 'last_ve'
vim +/last_ve +942 drivers/net/dsa/mxl862xx/mxl862xx.c
d587f9b6dcc98c Daniel Golle 2026-04-07 904
d587f9b6dcc98c Daniel Golle 2026-04-07 905 static int mxl862xx_vf_del_vid(struct mxl862xx_priv *priv,
d587f9b6dcc98c Daniel Golle 2026-04-07 906 struct mxl862xx_vf_block *vf, u16 vid)
d587f9b6dcc98c Daniel Golle 2026-04-07 907 {
d587f9b6dcc98c Daniel Golle 2026-04-07 908 struct mxl862xx_vf_vid *ve, *last_ve;
d587f9b6dcc98c Daniel Golle 2026-04-07 909 u16 gap, last;
d587f9b6dcc98c Daniel Golle 2026-04-07 910 int ret;
d587f9b6dcc98c Daniel Golle 2026-04-07 911
d587f9b6dcc98c Daniel Golle 2026-04-07 912 ve = mxl862xx_vf_find_vid(vf, vid);
d587f9b6dcc98c Daniel Golle 2026-04-07 913 if (!ve)
d587f9b6dcc98c Daniel Golle 2026-04-07 914 return 0;
d587f9b6dcc98c Daniel Golle 2026-04-07 915
d587f9b6dcc98c Daniel Golle 2026-04-07 916 if (!vf->allocated) {
d587f9b6dcc98c Daniel Golle 2026-04-07 917 /* Software-only state -- just remove the tracking entry */
d587f9b6dcc98c Daniel Golle 2026-04-07 918 list_del(&ve->list);
d587f9b6dcc98c Daniel Golle 2026-04-07 919 kfree(ve);
d587f9b6dcc98c Daniel Golle 2026-04-07 920 vf->active_count--;
d587f9b6dcc98c Daniel Golle 2026-04-07 921 return 0;
d587f9b6dcc98c Daniel Golle 2026-04-07 922 }
d587f9b6dcc98c Daniel Golle 2026-04-07 923
d587f9b6dcc98c Daniel Golle 2026-04-07 924 gap = ve->index;
d587f9b6dcc98c Daniel Golle 2026-04-07 925 last = vf->active_count - 1;
d587f9b6dcc98c Daniel Golle 2026-04-07 926
d587f9b6dcc98c Daniel Golle 2026-04-07 927 if (vf->active_count == 1) {
d587f9b6dcc98c Daniel Golle 2026-04-07 928 /* Last VID -- restore DISCARD sentinel at index 0 */
d587f9b6dcc98c Daniel Golle 2026-04-07 929 ret = mxl862xx_vf_entry_discard(priv, vf->block_id, 0);
d587f9b6dcc98c Daniel Golle 2026-04-07 930 if (ret)
d587f9b6dcc98c Daniel Golle 2026-04-07 931 return ret;
d587f9b6dcc98c Daniel Golle 2026-04-07 932 } else if (gap < last) {
d587f9b6dcc98c Daniel Golle 2026-04-07 933 /* Swap: move the last ALLOW entry into the gap */
d587f9b6dcc98c Daniel Golle 2026-04-07 934 list_for_each_entry(last_ve, &vf->vids, list)
d587f9b6dcc98c Daniel Golle 2026-04-07 935 if (last_ve->index == last)
d587f9b6dcc98c Daniel Golle 2026-04-07 936 break;
d587f9b6dcc98c Daniel Golle 2026-04-07 937
d587f9b6dcc98c Daniel Golle 2026-04-07 938 if (WARN_ON(list_entry_is_head(last_ve, &vf->vids, list)))
d587f9b6dcc98c Daniel Golle 2026-04-07 939 return -EINVAL;
d587f9b6dcc98c Daniel Golle 2026-04-07 940
d587f9b6dcc98c Daniel Golle 2026-04-07 941 ret = mxl862xx_vf_entry_set(priv, vf->block_id,
d587f9b6dcc98c Daniel Golle 2026-04-07 @942 gap, last_ve->vid);
d587f9b6dcc98c Daniel Golle 2026-04-07 943 if (ret)
d587f9b6dcc98c Daniel Golle 2026-04-07 944 return ret;
d587f9b6dcc98c Daniel Golle 2026-04-07 945
d587f9b6dcc98c Daniel Golle 2026-04-07 946 last_ve->index = gap;
d587f9b6dcc98c Daniel Golle 2026-04-07 947 }
d587f9b6dcc98c Daniel Golle 2026-04-07 948
d587f9b6dcc98c Daniel Golle 2026-04-07 949 list_del(&ve->list);
d587f9b6dcc98c Daniel Golle 2026-04-07 950 kfree(ve);
d587f9b6dcc98c Daniel Golle 2026-04-07 951 vf->active_count--;
d587f9b6dcc98c Daniel Golle 2026-04-07 952
d587f9b6dcc98c Daniel Golle 2026-04-07 953 return 0;
d587f9b6dcc98c Daniel Golle 2026-04-07 954 }
d587f9b6dcc98c Daniel Golle 2026-04-07 955
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
reply other threads:[~2026-04-11 7:25 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=202604111508.AZWFGSvb-lkp@intel.com \
--to=lkp@intel.com \
--cc=error27@gmail.com \
--cc=oe-kbuild@lists.linux.dev \
/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.