* Re: [net-next v9 2/2] net: sched: support hash/classid/cpuid selecting tx queue
@ 2022-02-23 13:49 kernel test robot
0 siblings, 0 replies; 3+ messages in thread
From: kernel test robot @ 2022-02-23 13:49 UTC (permalink / raw)
To: kbuild
[-- Attachment #1: Type: text/plain, Size: 54420 bytes --]
CC: llvm(a)lists.linux.dev
CC: kbuild-all(a)lists.01.org
In-Reply-To: <20220222112326.15070-3-xiangxia.m.yue@gmail.com>
References: <20220222112326.15070-3-xiangxia.m.yue@gmail.com>
TO: xiangxia.m.yue(a)gmail.com
TO: netdev(a)vger.kernel.org
CC: Tonghao Zhang <xiangxia.m.yue@gmail.com>
CC: Jamal Hadi Salim <jhs@mojatatu.com>
CC: Cong Wang <xiyou.wangcong@gmail.com>
CC: Jiri Pirko <jiri@resnulli.us>
CC: Jakub Kicinski <kuba@kernel.org>
CC: Jonathan Lemon <jonathan.lemon@gmail.com>
CC: Eric Dumazet <edumazet@google.com>
CC: Alexander Lobakin <alobakin@pm.me>
CC: Paolo Abeni <pabeni@redhat.com>
CC: Talal Ahmad <talalahmad@google.com>
CC: Kevin Hao <haokexin@gmail.com>
CC: Ilias Apalodimas <ilias.apalodimas@linaro.org>
CC: Kees Cook <keescook@chromium.org>
CC: Kumar Kartikeya Dwivedi <memxor@gmail.com>
CC: Antoine Tenart <atenart@kernel.org>
CC: Wei Wang <weiwan@google.com>
CC: Arnd Bergmann <arnd@arndb.de>
Hi,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on net-next/master]
url: https://github.com/0day-ci/linux/commits/xiangxia-m-yue-gmail-com/net-sched-allow-user-to-select-txqueue/20220222-192425
base: https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git 7b779cc8846ae0bfdad8eca7b751109a5cf930b7
:::::: branch date: 26 hours ago
:::::: commit date: 26 hours ago
config: riscv-randconfig-c006-20220221 (https://download.01.org/0day-ci/archive/20220223/202202232144.YI7vJiub-lkp(a)intel.com/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project d271fc04d5b97b12e6b797c6067d3c96a8d7470e)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# install riscv cross compiling tool for clang build
# apt-get install binutils-riscv64-linux-gnu
# https://github.com/0day-ci/linux/commit/7e77dbcb9661c380571e649ee555f715938b5326
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review xiangxia-m-yue-gmail-com/net-sched-allow-user-to-select-txqueue/20220222-192425
git checkout 7e77dbcb9661c380571e649ee555f715938b5326
# save the config file to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=riscv clang-analyzer
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
clang-analyzer warnings: (new ones prefixed by >>)
include/linux/minmax.h:28:26: note: expanded from macro '__cmp'
#define __cmp(x, y, op) ((x) op (y) ? (x) : (y))
^
drivers/hwmon/lm75.h:27:14: note: '__UNIQUE_ID___x189' is < '__UNIQUE_ID___y190'
int ntemp = clamp_val(temp, LM75_TEMP_MIN, LM75_TEMP_MAX);
^
include/linux/minmax.h:137:32: note: expanded from macro 'clamp_val'
#define clamp_val(val, lo, hi) clamp_t(typeof(val), val, lo, hi)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/minmax.h:124:36: note: expanded from macro 'clamp_t'
#define clamp_t(type, val, lo, hi) min_t(type, max_t(type, val, lo), hi)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/minmax.h:104:27: note: expanded from macro 'min_t'
#define min_t(type, x, y) __careful_cmp((type)(x), (type)(y), <)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/minmax.h:38:3: note: expanded from macro '__careful_cmp'
__cmp_once(x, y, __UNIQUE_ID(__x), __UNIQUE_ID(__y), op))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/minmax.h:33:3: note: expanded from macro '__cmp_once'
__cmp(unique_x, unique_y, op); })
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/minmax.h:28:26: note: expanded from macro '__cmp'
#define __cmp(x, y, op) ((x) op (y) ? (x) : (y))
^~~
drivers/hwmon/lm75.h:27:14: note: '?' condition is true
int ntemp = clamp_val(temp, LM75_TEMP_MIN, LM75_TEMP_MAX);
^
include/linux/minmax.h:137:32: note: expanded from macro 'clamp_val'
#define clamp_val(val, lo, hi) clamp_t(typeof(val), val, lo, hi)
^
include/linux/minmax.h:124:36: note: expanded from macro 'clamp_t'
#define clamp_t(type, val, lo, hi) min_t(type, max_t(type, val, lo), hi)
^
include/linux/minmax.h:104:27: note: expanded from macro 'min_t'
#define min_t(type, x, y) __careful_cmp((type)(x), (type)(y), <)
^
include/linux/minmax.h:38:3: note: expanded from macro '__careful_cmp'
__cmp_once(x, y, __UNIQUE_ID(__x), __UNIQUE_ID(__y), op))
^
include/linux/minmax.h:33:3: note: expanded from macro '__cmp_once'
__cmp(unique_x, unique_y, op); })
^
include/linux/minmax.h:28:26: note: expanded from macro '__cmp'
#define __cmp(x, y, op) ((x) op (y) ? (x) : (y))
^
drivers/hwmon/lm75.h:29:12: note: 'ntemp' is < 0
ntemp += (ntemp < 0 ? -250 : 250);
^~~~~
drivers/hwmon/lm75.h:29:12: note: '?' condition is true
drivers/hwmon/lm75.h:30:29: note: The result of the left shift is undefined because the left operand is negative
return (u16)((ntemp / 500) << 7);
~~~~~~~~~~~~~ ^
Suppressed 9 warnings (2 in non-user code, 7 with check filters).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
14 warnings generated.
drivers/media/dvb-frontends/cxd2820r_t.c:14:21: warning: Value stored to 'client' during its initialization is never read [clang-analyzer-deadcode.DeadStores]
struct i2c_client *client = priv->client[0];
^~~~~~ ~~~~~~~~~~~~~~~
drivers/media/dvb-frontends/cxd2820r_t.c:14:21: note: Value stored to 'client' during its initialization is never read
struct i2c_client *client = priv->client[0];
^~~~~~ ~~~~~~~~~~~~~~~
drivers/media/dvb-frontends/cxd2820r_t.c:130:21: warning: Value stored to 'client' during its initialization is never read [clang-analyzer-deadcode.DeadStores]
struct i2c_client *client = priv->client[0];
^~~~~~ ~~~~~~~~~~~~~~~
drivers/media/dvb-frontends/cxd2820r_t.c:130:21: note: Value stored to 'client' during its initialization is never read
struct i2c_client *client = priv->client[0];
^~~~~~ ~~~~~~~~~~~~~~~
drivers/media/dvb-frontends/cxd2820r_t.c:250:21: warning: Value stored to 'client' during its initialization is never read [clang-analyzer-deadcode.DeadStores]
struct i2c_client *client = priv->client[0];
^~~~~~ ~~~~~~~~~~~~~~~
drivers/media/dvb-frontends/cxd2820r_t.c:250:21: note: Value stored to 'client' during its initialization is never read
struct i2c_client *client = priv->client[0];
^~~~~~ ~~~~~~~~~~~~~~~
drivers/media/dvb-frontends/cxd2820r_t.c:375:21: warning: Value stored to 'client' during its initialization is never read [clang-analyzer-deadcode.DeadStores]
struct i2c_client *client = priv->client[0];
^~~~~~ ~~~~~~~~~~~~~~~
drivers/media/dvb-frontends/cxd2820r_t.c:375:21: note: Value stored to 'client' during its initialization is never read
struct i2c_client *client = priv->client[0];
^~~~~~ ~~~~~~~~~~~~~~~
drivers/media/dvb-frontends/cxd2820r_t.c:393:21: warning: Value stored to 'client' during its initialization is never read [clang-analyzer-deadcode.DeadStores]
struct i2c_client *client = priv->client[0];
^~~~~~ ~~~~~~~~~~~~~~~
drivers/media/dvb-frontends/cxd2820r_t.c:393:21: note: Value stored to 'client' during its initialization is never read
struct i2c_client *client = priv->client[0];
^~~~~~ ~~~~~~~~~~~~~~~
Suppressed 9 warnings (2 in non-user code, 7 with check filters).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
9 warnings generated.
Suppressed 9 warnings (2 in non-user code, 7 with check filters).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
9 warnings generated.
Suppressed 9 warnings (2 in non-user code, 7 with check filters).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
10 warnings generated.
Suppressed 10 warnings (3 in non-user code, 7 with check filters).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
9 warnings generated.
Suppressed 9 warnings (2 in non-user code, 7 with check filters).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
13 warnings generated.
>> net/sched/act_skbedit.c:272:26: warning: Dereference of null pointer (loaded from variable 'priority') [clang-analyzer-core.NullDereference]
params_new->priority = *priority;
^~~~~~~~~
net/sched/act_skbedit.c:147:18: note: 'priority' initialized to a null pointer value
u32 flags = 0, *priority = NULL, *mark = NULL, *mask = NULL;
^~~~~~~~
net/sched/act_skbedit.c:154:6: note: Assuming 'nla' is not equal to NULL
if (nla == NULL)
^~~~~~~~~~~
net/sched/act_skbedit.c:154:2: note: Taking false branch
if (nla == NULL)
^
net/sched/act_skbedit.c:157:8: note: Calling 'nla_parse_nested_deprecated'
err = nla_parse_nested_deprecated(tb, TCA_SKBEDIT_MAX, nla,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/net/netlink.h:1231:9: note: Assigning value, which participates in a condition later
return __nla_parse(tb, maxtype, nla_data(nla), nla_len(nla), policy,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/sched/act_skbedit.c:157:8: note: Returning from 'nla_parse_nested_deprecated'
err = nla_parse_nested_deprecated(tb, TCA_SKBEDIT_MAX, nla,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/sched/act_skbedit.c:159:6: note: Assuming 'err' is >= 0
if (err < 0)
^~~~~~~
net/sched/act_skbedit.c:159:2: note: Taking false branch
if (err < 0)
^
net/sched/act_skbedit.c:162:6: note: Assuming the condition is false
if (tb[TCA_SKBEDIT_PARMS] == NULL)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/sched/act_skbedit.c:162:2: note: Taking false branch
if (tb[TCA_SKBEDIT_PARMS] == NULL)
^
net/sched/act_skbedit.c:165:6: note: Assuming the condition is false
if (tb[TCA_SKBEDIT_PRIORITY] != NULL) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/sched/act_skbedit.c:165:2: note: Taking false branch
if (tb[TCA_SKBEDIT_PRIORITY] != NULL) {
^
net/sched/act_skbedit.c:170:6: note: Assuming the condition is true
if (tb[TCA_SKBEDIT_QUEUE_MAPPING] != NULL) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/sched/act_skbedit.c:170:2: note: Taking true branch
if (tb[TCA_SKBEDIT_QUEUE_MAPPING] != NULL) {
^
net/sched/act_skbedit.c:175:6: note: Assuming the condition is false
if (tb[TCA_SKBEDIT_PTYPE] != NULL) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/sched/act_skbedit.c:175:2: note: Taking false branch
if (tb[TCA_SKBEDIT_PTYPE] != NULL) {
^
net/sched/act_skbedit.c:182:6: note: Assuming the condition is false
if (tb[TCA_SKBEDIT_MARK] != NULL) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/sched/act_skbedit.c:182:2: note: Taking false branch
if (tb[TCA_SKBEDIT_MARK] != NULL) {
^
net/sched/act_skbedit.c:187:6: note: Assuming the condition is false
if (tb[TCA_SKBEDIT_MASK] != NULL) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/sched/act_skbedit.c:187:2: note: Taking false branch
if (tb[TCA_SKBEDIT_MASK] != NULL) {
^
net/sched/act_skbedit.c:192:6: note: Assuming the condition is true
if (tb[TCA_SKBEDIT_FLAGS] != NULL) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/sched/act_skbedit.c:192:2: note: Taking true branch
if (tb[TCA_SKBEDIT_FLAGS] != NULL) {
^
net/sched/act_skbedit.c:197:7: note: Assuming 'mapping_hash_type' is not equal to 0
if (mapping_hash_type) {
^~~~~~~~~~~~~~~~~
net/sched/act_skbedit.c:197:3: note: Taking true branch
if (mapping_hash_type) {
^
net/sched/act_skbedit.c:201:8: note: Assuming the condition is false
if (mapping_hash_type & (mapping_hash_type - 1)) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/sched/act_skbedit.c:201:4: note: Taking false branch
if (mapping_hash_type & (mapping_hash_type - 1)) {
^
net/sched/act_skbedit.c:206:8: note: Left side of '||' is false
if (!tb[TCA_SKBEDIT_QUEUE_MAPPING] ||
^
net/sched/act_skbedit.c:207:8: note: Assuming the condition is false
!tb[TCA_SKBEDIT_QUEUE_MAPPING_MAX]) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/sched/act_skbedit.c:206:4: note: Taking false branch
if (!tb[TCA_SKBEDIT_QUEUE_MAPPING] ||
^
net/sched/act_skbedit.c:214:8: note: Assuming the condition is false
if (*queue_mapping_max < *queue_mapping) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/sched/act_skbedit.c:214:4: note: Taking false branch
if (*queue_mapping_max < *queue_mapping) {
^
net/sched/act_skbedit.c:222:7: note: Assuming the condition is false
if (*pure_flags & SKBEDIT_F_INHERITDSFIELD)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/sched/act_skbedit.c:222:3: note: Taking false branch
if (*pure_flags & SKBEDIT_F_INHERITDSFIELD)
^
net/sched/act_skbedit.c:229:6: note: Assuming 'err' is >= 0
if (err < 0)
^~~~~~~
net/sched/act_skbedit.c:229:2: note: Taking false branch
if (err < 0)
^
net/sched/act_skbedit.c:232:6: note: Assuming 'exists' is true
if (exists && bind)
^~~~~~
net/sched/act_skbedit.c:232:6: note: Left side of '&&' is true
net/sched/act_skbedit.c:232:16: note: Assuming 'bind' is false
if (exists && bind)
^~~~
net/sched/act_skbedit.c:232:2: note: Taking false branch
if (exists && bind)
^
net/sched/act_skbedit.c:235:7: note: 'flags' is not equal to 0
if (!flags) {
^~~~~
net/sched/act_skbedit.c:235:2: note: Taking false branch
if (!flags) {
^
net/sched/act_skbedit.c:243:7: note: 'exists' is true
if (!exists) {
^~~~~~
net/sched/act_skbedit.c:243:2: note: Taking false branch
if (!exists) {
^
net/sched/act_skbedit.c:255:7: note: Assuming the condition is false
if (!(act_flags & TCA_ACT_FLAGS_REPLACE)) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/sched/act_skbedit.c:255:3: note: Taking false branch
if (!(act_flags & TCA_ACT_FLAGS_REPLACE)) {
^
net/sched/act_skbedit.c:261:6: note: Assuming 'err' is >= 0
if (err < 0)
^~~~~~~
net/sched/act_skbedit.c:261:2: note: Taking false branch
if (err < 0)
^
net/sched/act_skbedit.c:265:15: note: Assuming 'params_new' is non-null
if (unlikely(!params_new)) {
^
include/linux/compiler.h:78:42: note: expanded from macro 'unlikely'
# define unlikely(x) __builtin_expect(!!(x), 0)
^
net/sched/act_skbedit.c:265:2: note: Taking false branch
if (unlikely(!params_new)) {
^
net/sched/act_skbedit.c:271:6: note: Assuming the condition is true
if (flags & SKBEDIT_F_PRIORITY)
^~~~~~~~~~~~~~~~~~~~~~~~~~
net/sched/act_skbedit.c:271:2: note: Taking true branch
if (flags & SKBEDIT_F_PRIORITY)
^
net/sched/act_skbedit.c:272:26: note: Dereference of null pointer (loaded from variable 'priority')
params_new->priority = *priority;
^~~~~~~~~
>> net/sched/act_skbedit.c:278:22: warning: Dereference of null pointer (loaded from variable 'mark') [clang-analyzer-core.NullDereference]
params_new->mark = *mark;
^~~~~
net/sched/act_skbedit.c:147:36: note: 'mark' initialized to a null pointer value
u32 flags = 0, *priority = NULL, *mark = NULL, *mask = NULL;
^~~~
net/sched/act_skbedit.c:154:6: note: Assuming 'nla' is not equal to NULL
if (nla == NULL)
^~~~~~~~~~~
net/sched/act_skbedit.c:154:2: note: Taking false branch
if (nla == NULL)
^
net/sched/act_skbedit.c:157:8: note: Calling 'nla_parse_nested_deprecated'
err = nla_parse_nested_deprecated(tb, TCA_SKBEDIT_MAX, nla,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/net/netlink.h:1231:9: note: Assigning value, which participates in a condition later
return __nla_parse(tb, maxtype, nla_data(nla), nla_len(nla), policy,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/sched/act_skbedit.c:157:8: note: Returning from 'nla_parse_nested_deprecated'
err = nla_parse_nested_deprecated(tb, TCA_SKBEDIT_MAX, nla,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/sched/act_skbedit.c:159:6: note: Assuming 'err' is >= 0
if (err < 0)
^~~~~~~
net/sched/act_skbedit.c:159:2: note: Taking false branch
if (err < 0)
^
net/sched/act_skbedit.c:162:6: note: Assuming the condition is false
if (tb[TCA_SKBEDIT_PARMS] == NULL)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/sched/act_skbedit.c:162:2: note: Taking false branch
if (tb[TCA_SKBEDIT_PARMS] == NULL)
^
net/sched/act_skbedit.c:165:6: note: Assuming the condition is false
if (tb[TCA_SKBEDIT_PRIORITY] != NULL) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/sched/act_skbedit.c:165:2: note: Taking false branch
if (tb[TCA_SKBEDIT_PRIORITY] != NULL) {
^
net/sched/act_skbedit.c:170:6: note: Assuming the condition is true
if (tb[TCA_SKBEDIT_QUEUE_MAPPING] != NULL) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/sched/act_skbedit.c:170:2: note: Taking true branch
if (tb[TCA_SKBEDIT_QUEUE_MAPPING] != NULL) {
^
net/sched/act_skbedit.c:175:6: note: Assuming the condition is false
if (tb[TCA_SKBEDIT_PTYPE] != NULL) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/sched/act_skbedit.c:175:2: note: Taking false branch
if (tb[TCA_SKBEDIT_PTYPE] != NULL) {
^
net/sched/act_skbedit.c:182:6: note: Assuming the condition is false
if (tb[TCA_SKBEDIT_MARK] != NULL) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/sched/act_skbedit.c:182:2: note: Taking false branch
if (tb[TCA_SKBEDIT_MARK] != NULL) {
^
net/sched/act_skbedit.c:187:6: note: Assuming the condition is false
if (tb[TCA_SKBEDIT_MASK] != NULL) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/sched/act_skbedit.c:187:2: note: Taking false branch
if (tb[TCA_SKBEDIT_MASK] != NULL) {
^
net/sched/act_skbedit.c:192:6: note: Assuming the condition is true
if (tb[TCA_SKBEDIT_FLAGS] != NULL) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/sched/act_skbedit.c:192:2: note: Taking true branch
if (tb[TCA_SKBEDIT_FLAGS] != NULL) {
^
net/sched/act_skbedit.c:197:7: note: Assuming 'mapping_hash_type' is not equal to 0
if (mapping_hash_type) {
^~~~~~~~~~~~~~~~~
net/sched/act_skbedit.c:197:3: note: Taking true branch
if (mapping_hash_type) {
^
net/sched/act_skbedit.c:201:8: note: Assuming the condition is false
if (mapping_hash_type & (mapping_hash_type - 1)) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/sched/act_skbedit.c:201:4: note: Taking false branch
if (mapping_hash_type & (mapping_hash_type - 1)) {
^
net/sched/act_skbedit.c:206:8: note: Left side of '||' is false
if (!tb[TCA_SKBEDIT_QUEUE_MAPPING] ||
^
net/sched/act_skbedit.c:207:8: note: Assuming the condition is false
!tb[TCA_SKBEDIT_QUEUE_MAPPING_MAX]) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/sched/act_skbedit.c:206:4: note: Taking false branch
if (!tb[TCA_SKBEDIT_QUEUE_MAPPING] ||
^
net/sched/act_skbedit.c:214:8: note: Assuming the condition is false
if (*queue_mapping_max < *queue_mapping) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/sched/act_skbedit.c:214:4: note: Taking false branch
if (*queue_mapping_max < *queue_mapping) {
^
net/sched/act_skbedit.c:222:7: note: Assuming the condition is false
if (*pure_flags & SKBEDIT_F_INHERITDSFIELD)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/sched/act_skbedit.c:222:3: note: Taking false branch
if (*pure_flags & SKBEDIT_F_INHERITDSFIELD)
^
net/sched/act_skbedit.c:229:6: note: Assuming 'err' is >= 0
if (err < 0)
^~~~~~~
net/sched/act_skbedit.c:229:2: note: Taking false branch
if (err < 0)
^
net/sched/act_skbedit.c:232:6: note: Assuming 'exists' is true
if (exists && bind)
^~~~~~
net/sched/act_skbedit.c:232:6: note: Left side of '&&' is true
net/sched/act_skbedit.c:232:16: note: Assuming 'bind' is false
if (exists && bind)
^~~~
net/sched/act_skbedit.c:232:2: note: Taking false branch
if (exists && bind)
^
net/sched/act_skbedit.c:235:7: note: 'flags' is not equal to 0
if (!flags) {
^~~~~
net/sched/act_skbedit.c:235:2: note: Taking false branch
if (!flags) {
^
net/sched/act_skbedit.c:243:7: note: 'exists' is true
if (!exists) {
^~~~~~
net/sched/act_skbedit.c:243:2: note: Taking false branch
if (!exists) {
^
net/sched/act_skbedit.c:255:7: note: Assuming the condition is false
if (!(act_flags & TCA_ACT_FLAGS_REPLACE)) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/sched/act_skbedit.c:255:3: note: Taking false branch
if (!(act_flags & TCA_ACT_FLAGS_REPLACE)) {
^
net/sched/act_skbedit.c:261:6: note: Assuming 'err' is >= 0
if (err < 0)
^~~~~~~
net/sched/act_skbedit.c:261:2: note: Taking false branch
if (err < 0)
^
net/sched/act_skbedit.c:265:15: note: Assuming 'params_new' is non-null
if (unlikely(!params_new)) {
^
include/linux/compiler.h:78:42: note: expanded from macro 'unlikely'
# define unlikely(x) __builtin_expect(!!(x), 0)
^
net/sched/act_skbedit.c:265:2: note: Taking false branch
if (unlikely(!params_new)) {
^
net/sched/act_skbedit.c:271:6: note: Assuming the condition is false
if (flags & SKBEDIT_F_PRIORITY)
^~~~~~~~~~~~~~~~~~~~~~~~~~
net/sched/act_skbedit.c:271:2: note: Taking false branch
if (flags & SKBEDIT_F_PRIORITY)
^
net/sched/act_skbedit.c:273:6: note: Assuming the condition is false
if (flags & SKBEDIT_F_QUEUE_MAPPING) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/sched/act_skbedit.c:273:2: note: Taking false branch
if (flags & SKBEDIT_F_QUEUE_MAPPING) {
^
net/sched/act_skbedit.c:277:6: note: Assuming the condition is true
if (flags & SKBEDIT_F_MARK)
^~~~~~~~~~~~~~~~~~~~~~
net/sched/act_skbedit.c:277:2: note: Taking true branch
if (flags & SKBEDIT_F_MARK)
^
net/sched/act_skbedit.c:278:22: note: Dereference of null pointer (loaded from variable 'mark')
params_new->mark = *mark;
^~~~~
>> net/sched/act_skbedit.c:280:23: warning: Dereference of null pointer (loaded from variable 'ptype') [clang-analyzer-core.NullDereference]
params_new->ptype = *ptype;
^~~~~~
net/sched/act_skbedit.c:148:30: note: 'ptype' initialized to a null pointer value
u16 *queue_mapping = NULL, *ptype = NULL;
^~~~~
net/sched/act_skbedit.c:154:6: note: Assuming 'nla' is not equal to NULL
if (nla == NULL)
^~~~~~~~~~~
net/sched/act_skbedit.c:154:2: note: Taking false branch
if (nla == NULL)
^
net/sched/act_skbedit.c:157:8: note: Calling 'nla_parse_nested_deprecated'
err = nla_parse_nested_deprecated(tb, TCA_SKBEDIT_MAX, nla,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/net/netlink.h:1231:9: note: Assigning value, which participates in a condition later
return __nla_parse(tb, maxtype, nla_data(nla), nla_len(nla), policy,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/sched/act_skbedit.c:157:8: note: Returning from 'nla_parse_nested_deprecated'
err = nla_parse_nested_deprecated(tb, TCA_SKBEDIT_MAX, nla,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/sched/act_skbedit.c:159:6: note: Assuming 'err' is >= 0
if (err < 0)
^~~~~~~
net/sched/act_skbedit.c:159:2: note: Taking false branch
if (err < 0)
^
net/sched/act_skbedit.c:162:6: note: Assuming the condition is false
if (tb[TCA_SKBEDIT_PARMS] == NULL)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/sched/act_skbedit.c:162:2: note: Taking false branch
if (tb[TCA_SKBEDIT_PARMS] == NULL)
^
net/sched/act_skbedit.c:165:6: note: Assuming the condition is false
if (tb[TCA_SKBEDIT_PRIORITY] != NULL) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/sched/act_skbedit.c:165:2: note: Taking false branch
if (tb[TCA_SKBEDIT_PRIORITY] != NULL) {
^
net/sched/act_skbedit.c:170:6: note: Assuming the condition is true
if (tb[TCA_SKBEDIT_QUEUE_MAPPING] != NULL) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/sched/act_skbedit.c:170:2: note: Taking true branch
if (tb[TCA_SKBEDIT_QUEUE_MAPPING] != NULL) {
^
net/sched/act_skbedit.c:175:6: note: Assuming the condition is false
if (tb[TCA_SKBEDIT_PTYPE] != NULL) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/sched/act_skbedit.c:175:2: note: Taking false branch
if (tb[TCA_SKBEDIT_PTYPE] != NULL) {
^
net/sched/act_skbedit.c:182:6: note: Assuming the condition is false
if (tb[TCA_SKBEDIT_MARK] != NULL) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/sched/act_skbedit.c:182:2: note: Taking false branch
if (tb[TCA_SKBEDIT_MARK] != NULL) {
^
net/sched/act_skbedit.c:187:6: note: Assuming the condition is false
if (tb[TCA_SKBEDIT_MASK] != NULL) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/sched/act_skbedit.c:187:2: note: Taking false branch
if (tb[TCA_SKBEDIT_MASK] != NULL) {
^
net/sched/act_skbedit.c:192:6: note: Assuming the condition is true
if (tb[TCA_SKBEDIT_FLAGS] != NULL) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/sched/act_skbedit.c:192:2: note: Taking true branch
if (tb[TCA_SKBEDIT_FLAGS] != NULL) {
^
net/sched/act_skbedit.c:197:7: note: Assuming 'mapping_hash_type' is not equal to 0
if (mapping_hash_type) {
^~~~~~~~~~~~~~~~~
net/sched/act_skbedit.c:197:3: note: Taking true branch
if (mapping_hash_type) {
^
net/sched/act_skbedit.c:201:8: note: Assuming the condition is false
if (mapping_hash_type & (mapping_hash_type - 1)) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/sched/act_skbedit.c:201:4: note: Taking false branch
if (mapping_hash_type & (mapping_hash_type - 1)) {
^
net/sched/act_skbedit.c:206:8: note: Left side of '||' is false
if (!tb[TCA_SKBEDIT_QUEUE_MAPPING] ||
^
net/sched/act_skbedit.c:207:8: note: Assuming the condition is false
!tb[TCA_SKBEDIT_QUEUE_MAPPING_MAX]) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/sched/act_skbedit.c:206:4: note: Taking false branch
if (!tb[TCA_SKBEDIT_QUEUE_MAPPING] ||
^
net/sched/act_skbedit.c:214:8: note: Assuming the condition is false
if (*queue_mapping_max < *queue_mapping) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/sched/act_skbedit.c:214:4: note: Taking false branch
if (*queue_mapping_max < *queue_mapping) {
^
net/sched/act_skbedit.c:222:7: note: Assuming the condition is false
if (*pure_flags & SKBEDIT_F_INHERITDSFIELD)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/sched/act_skbedit.c:222:3: note: Taking false branch
if (*pure_flags & SKBEDIT_F_INHERITDSFIELD)
^
net/sched/act_skbedit.c:229:6: note: Assuming 'err' is >= 0
if (err < 0)
^~~~~~~
net/sched/act_skbedit.c:229:2: note: Taking false branch
if (err < 0)
^
net/sched/act_skbedit.c:232:6: note: Assuming 'exists' is true
if (exists && bind)
^~~~~~
net/sched/act_skbedit.c:232:6: note: Left side of '&&' is true
net/sched/act_skbedit.c:232:16: note: Assuming 'bind' is false
if (exists && bind)
^~~~
net/sched/act_skbedit.c:232:2: note: Taking false branch
if (exists && bind)
^
net/sched/act_skbedit.c:235:7: note: 'flags' is not equal to 0
if (!flags) {
^~~~~
net/sched/act_skbedit.c:235:2: note: Taking false branch
if (!flags) {
^
net/sched/act_skbedit.c:243:7: note: 'exists' is true
if (!exists) {
^~~~~~
net/sched/act_skbedit.c:243:2: note: Taking false branch
if (!exists) {
^
net/sched/act_skbedit.c:255:7: note: Assuming the condition is false
if (!(act_flags & TCA_ACT_FLAGS_REPLACE)) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/sched/act_skbedit.c:255:3: note: Taking false branch
if (!(act_flags & TCA_ACT_FLAGS_REPLACE)) {
^
net/sched/act_skbedit.c:261:6: note: Assuming 'err' is >= 0
if (err < 0)
^~~~~~~
net/sched/act_skbedit.c:261:2: note: Taking false branch
if (err < 0)
^
net/sched/act_skbedit.c:265:15: note: Assuming 'params_new' is non-null
if (unlikely(!params_new)) {
^
include/linux/compiler.h:78:42: note: expanded from macro 'unlikely'
# define unlikely(x) __builtin_expect(!!(x), 0)
^
net/sched/act_skbedit.c:265:2: note: Taking false branch
if (unlikely(!params_new)) {
^
net/sched/act_skbedit.c:271:6: note: Assuming the condition is false
if (flags & SKBEDIT_F_PRIORITY)
^~~~~~~~~~~~~~~~~~~~~~~~~~
net/sched/act_skbedit.c:271:2: note: Taking false branch
if (flags & SKBEDIT_F_PRIORITY)
^
net/sched/act_skbedit.c:273:6: note: Assuming the condition is false
if (flags & SKBEDIT_F_QUEUE_MAPPING) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/sched/act_skbedit.c:273:2: note: Taking false branch
if (flags & SKBEDIT_F_QUEUE_MAPPING) {
^
net/sched/act_skbedit.c:277:6: note: Assuming the condition is false
if (flags & SKBEDIT_F_MARK)
^~~~~~~~~~~~~~~~~~~~~~
net/sched/act_skbedit.c:277:2: note: Taking false branch
if (flags & SKBEDIT_F_MARK)
^
net/sched/act_skbedit.c:279:6: note: Assuming the condition is true
if (flags & SKBEDIT_F_PTYPE)
^~~~~~~~~~~~~~~~~~~~~~~
net/sched/act_skbedit.c:279:2: note: Taking true branch
if (flags & SKBEDIT_F_PTYPE)
^
net/sched/act_skbedit.c:280:23: note: Dereference of null pointer (loaded from variable 'ptype')
params_new->ptype = *ptype;
^~~~~~
>> net/sched/act_skbedit.c:284:22: warning: Dereference of null pointer (loaded from variable 'mask') [clang-analyzer-core.NullDereference]
params_new->mask = *mask;
^~~~~
net/sched/act_skbedit.c:147:50: note: 'mask' initialized to a null pointer value
u32 flags = 0, *priority = NULL, *mark = NULL, *mask = NULL;
^~~~
net/sched/act_skbedit.c:154:6: note: Assuming 'nla' is not equal to NULL
if (nla == NULL)
^~~~~~~~~~~
net/sched/act_skbedit.c:154:2: note: Taking false branch
if (nla == NULL)
^
net/sched/act_skbedit.c:157:8: note: Calling 'nla_parse_nested_deprecated'
err = nla_parse_nested_deprecated(tb, TCA_SKBEDIT_MAX, nla,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/net/netlink.h:1231:9: note: Assigning value, which participates in a condition later
return __nla_parse(tb, maxtype, nla_data(nla), nla_len(nla), policy,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/sched/act_skbedit.c:157:8: note: Returning from 'nla_parse_nested_deprecated'
err = nla_parse_nested_deprecated(tb, TCA_SKBEDIT_MAX, nla,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/sched/act_skbedit.c:159:6: note: Assuming 'err' is >= 0
if (err < 0)
^~~~~~~
net/sched/act_skbedit.c:159:2: note: Taking false branch
if (err < 0)
^
net/sched/act_skbedit.c:162:6: note: Assuming the condition is false
if (tb[TCA_SKBEDIT_PARMS] == NULL)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/sched/act_skbedit.c:162:2: note: Taking false branch
if (tb[TCA_SKBEDIT_PARMS] == NULL)
^
net/sched/act_skbedit.c:165:6: note: Assuming the condition is false
if (tb[TCA_SKBEDIT_PRIORITY] != NULL) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/sched/act_skbedit.c:165:2: note: Taking false branch
if (tb[TCA_SKBEDIT_PRIORITY] != NULL) {
^
net/sched/act_skbedit.c:170:6: note: Assuming the condition is true
if (tb[TCA_SKBEDIT_QUEUE_MAPPING] != NULL) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/sched/act_skbedit.c:170:2: note: Taking true branch
if (tb[TCA_SKBEDIT_QUEUE_MAPPING] != NULL) {
^
net/sched/act_skbedit.c:175:6: note: Assuming the condition is false
if (tb[TCA_SKBEDIT_PTYPE] != NULL) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/sched/act_skbedit.c:175:2: note: Taking false branch
if (tb[TCA_SKBEDIT_PTYPE] != NULL) {
^
net/sched/act_skbedit.c:182:6: note: Assuming the condition is false
if (tb[TCA_SKBEDIT_MARK] != NULL) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/sched/act_skbedit.c:182:2: note: Taking false branch
if (tb[TCA_SKBEDIT_MARK] != NULL) {
^
net/sched/act_skbedit.c:187:6: note: Assuming the condition is false
if (tb[TCA_SKBEDIT_MASK] != NULL) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/sched/act_skbedit.c:187:2: note: Taking false branch
if (tb[TCA_SKBEDIT_MASK] != NULL) {
^
net/sched/act_skbedit.c:192:6: note: Assuming the condition is true
if (tb[TCA_SKBEDIT_FLAGS] != NULL) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/sched/act_skbedit.c:192:2: note: Taking true branch
if (tb[TCA_SKBEDIT_FLAGS] != NULL) {
^
net/sched/act_skbedit.c:197:7: note: Assuming 'mapping_hash_type' is not equal to 0
if (mapping_hash_type) {
^~~~~~~~~~~~~~~~~
net/sched/act_skbedit.c:197:3: note: Taking true branch
if (mapping_hash_type) {
^
net/sched/act_skbedit.c:201:8: note: Assuming the condition is false
if (mapping_hash_type & (mapping_hash_type - 1)) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/sched/act_skbedit.c:201:4: note: Taking false branch
if (mapping_hash_type & (mapping_hash_type - 1)) {
^
net/sched/act_skbedit.c:206:8: note: Left side of '||' is false
if (!tb[TCA_SKBEDIT_QUEUE_MAPPING] ||
^
net/sched/act_skbedit.c:207:8: note: Assuming the condition is false
!tb[TCA_SKBEDIT_QUEUE_MAPPING_MAX]) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/sched/act_skbedit.c:206:4: note: Taking false branch
if (!tb[TCA_SKBEDIT_QUEUE_MAPPING] ||
^
net/sched/act_skbedit.c:214:8: note: Assuming the condition is false
if (*queue_mapping_max < *queue_mapping) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/sched/act_skbedit.c:214:4: note: Taking false branch
if (*queue_mapping_max < *queue_mapping) {
^
net/sched/act_skbedit.c:222:7: note: Assuming the condition is false
if (*pure_flags & SKBEDIT_F_INHERITDSFIELD)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/sched/act_skbedit.c:222:3: note: Taking false branch
if (*pure_flags & SKBEDIT_F_INHERITDSFIELD)
vim +/priority +272 net/sched/act_skbedit.c
ca9b0e27e072be Alexander Duyck 2008-09-12 134
c1b52739e45f59 Benjamin LaHaise 2013-01-14 135 static int tcf_skbedit_init(struct net *net, struct nlattr *nla,
a85a970af265f1 WANG Cong 2016-07-25 136 struct nlattr *est, struct tc_action **a,
abbb0d33632ce9 Vlad Buslov 2019-10-30 137 struct tcf_proto *tp, u32 act_flags,
789871bb2a0381 Vlad Buslov 2018-07-05 138 struct netlink_ext_ack *extack)
ca9b0e27e072be Alexander Duyck 2008-09-12 139 {
ddf97ccdd7cb7e WANG Cong 2016-02-22 140 struct tc_action_net *tn = net_generic(net, skbedit_net_id);
695176bfe5dec2 Cong Wang 2021-07-29 141 bool bind = act_flags & TCA_ACT_FLAGS_BIND;
6d7a8df6dfe4d6 Vlad Buslov 2018-09-03 142 struct tcf_skbedit_params *params_new;
ca9b0e27e072be Alexander Duyck 2008-09-12 143 struct nlattr *tb[TCA_SKBEDIT_MAX + 1];
ec7727bb24b01e Davide Caratti 2019-03-20 144 struct tcf_chain *goto_ch = NULL;
ca9b0e27e072be Alexander Duyck 2008-09-12 145 struct tc_skbedit *parm;
ca9b0e27e072be Alexander Duyck 2008-09-12 146 struct tcf_skbedit *d;
4fe77d82ef80c7 Antonio Quartulli 2016-10-24 147 u32 flags = 0, *priority = NULL, *mark = NULL, *mask = NULL;
ff202ee1ed8f03 Jamal Hadi Salim 2016-07-02 148 u16 *queue_mapping = NULL, *ptype = NULL;
7e77dbcb9661c3 Tonghao Zhang 2022-02-22 149 u16 mapping_mod = 1;
b2313077ed0db3 WANG Cong 2016-06-13 150 bool exists = false;
b2313077ed0db3 WANG Cong 2016-06-13 151 int ret = 0, err;
7be8ef2cdbfe41 Dmytro Linkin 2019-08-01 152 u32 index;
ca9b0e27e072be Alexander Duyck 2008-09-12 153
ca9b0e27e072be Alexander Duyck 2008-09-12 154 if (nla == NULL)
ca9b0e27e072be Alexander Duyck 2008-09-12 155 return -EINVAL;
ca9b0e27e072be Alexander Duyck 2008-09-12 156
8cb081746c031f Johannes Berg 2019-04-26 157 err = nla_parse_nested_deprecated(tb, TCA_SKBEDIT_MAX, nla,
8cb081746c031f Johannes Berg 2019-04-26 158 skbedit_policy, NULL);
ca9b0e27e072be Alexander Duyck 2008-09-12 159 if (err < 0)
ca9b0e27e072be Alexander Duyck 2008-09-12 160 return err;
ca9b0e27e072be Alexander Duyck 2008-09-12 161
ca9b0e27e072be Alexander Duyck 2008-09-12 162 if (tb[TCA_SKBEDIT_PARMS] == NULL)
ca9b0e27e072be Alexander Duyck 2008-09-12 163 return -EINVAL;
ca9b0e27e072be Alexander Duyck 2008-09-12 164
ca9b0e27e072be Alexander Duyck 2008-09-12 165 if (tb[TCA_SKBEDIT_PRIORITY] != NULL) {
ca9b0e27e072be Alexander Duyck 2008-09-12 166 flags |= SKBEDIT_F_PRIORITY;
ca9b0e27e072be Alexander Duyck 2008-09-12 167 priority = nla_data(tb[TCA_SKBEDIT_PRIORITY]);
ca9b0e27e072be Alexander Duyck 2008-09-12 168 }
ca9b0e27e072be Alexander Duyck 2008-09-12 169
ca9b0e27e072be Alexander Duyck 2008-09-12 170 if (tb[TCA_SKBEDIT_QUEUE_MAPPING] != NULL) {
ca9b0e27e072be Alexander Duyck 2008-09-12 171 flags |= SKBEDIT_F_QUEUE_MAPPING;
ca9b0e27e072be Alexander Duyck 2008-09-12 172 queue_mapping = nla_data(tb[TCA_SKBEDIT_QUEUE_MAPPING]);
ca9b0e27e072be Alexander Duyck 2008-09-12 173 }
1c55d62e77fa16 jamal 2009-10-15 174
ff202ee1ed8f03 Jamal Hadi Salim 2016-07-02 175 if (tb[TCA_SKBEDIT_PTYPE] != NULL) {
ff202ee1ed8f03 Jamal Hadi Salim 2016-07-02 176 ptype = nla_data(tb[TCA_SKBEDIT_PTYPE]);
ff202ee1ed8f03 Jamal Hadi Salim 2016-07-02 177 if (!skb_pkt_type_ok(*ptype))
ff202ee1ed8f03 Jamal Hadi Salim 2016-07-02 178 return -EINVAL;
ff202ee1ed8f03 Jamal Hadi Salim 2016-07-02 179 flags |= SKBEDIT_F_PTYPE;
ff202ee1ed8f03 Jamal Hadi Salim 2016-07-02 180 }
ff202ee1ed8f03 Jamal Hadi Salim 2016-07-02 181
1c55d62e77fa16 jamal 2009-10-15 182 if (tb[TCA_SKBEDIT_MARK] != NULL) {
1c55d62e77fa16 jamal 2009-10-15 183 flags |= SKBEDIT_F_MARK;
1c55d62e77fa16 jamal 2009-10-15 184 mark = nla_data(tb[TCA_SKBEDIT_MARK]);
1c55d62e77fa16 jamal 2009-10-15 185 }
1c55d62e77fa16 jamal 2009-10-15 186
4fe77d82ef80c7 Antonio Quartulli 2016-10-24 187 if (tb[TCA_SKBEDIT_MASK] != NULL) {
4fe77d82ef80c7 Antonio Quartulli 2016-10-24 188 flags |= SKBEDIT_F_MASK;
4fe77d82ef80c7 Antonio Quartulli 2016-10-24 189 mask = nla_data(tb[TCA_SKBEDIT_MASK]);
4fe77d82ef80c7 Antonio Quartulli 2016-10-24 190 }
4fe77d82ef80c7 Antonio Quartulli 2016-10-24 191
e7e3728bd776d1 Qiaobin Fu 2018-07-01 192 if (tb[TCA_SKBEDIT_FLAGS] != NULL) {
e7e3728bd776d1 Qiaobin Fu 2018-07-01 193 u64 *pure_flags = nla_data(tb[TCA_SKBEDIT_FLAGS]);
7e77dbcb9661c3 Tonghao Zhang 2022-02-22 194 u64 mapping_hash_type;
e7e3728bd776d1 Qiaobin Fu 2018-07-01 195
7e77dbcb9661c3 Tonghao Zhang 2022-02-22 196 mapping_hash_type = *pure_flags & SKBEDIT_F_TXQ_HASH_MASK;
7e77dbcb9661c3 Tonghao Zhang 2022-02-22 197 if (mapping_hash_type) {
7e77dbcb9661c3 Tonghao Zhang 2022-02-22 198 u16 *queue_mapping_max;
7e77dbcb9661c3 Tonghao Zhang 2022-02-22 199
7e77dbcb9661c3 Tonghao Zhang 2022-02-22 200 /* Hash types are mutually exclusive. */
7e77dbcb9661c3 Tonghao Zhang 2022-02-22 201 if (mapping_hash_type & (mapping_hash_type - 1)) {
7e77dbcb9661c3 Tonghao Zhang 2022-02-22 202 NL_SET_ERR_MSG_MOD(extack, "Multi types of hash are specified.");
7e77dbcb9661c3 Tonghao Zhang 2022-02-22 203 return -EINVAL;
7e77dbcb9661c3 Tonghao Zhang 2022-02-22 204 }
7e77dbcb9661c3 Tonghao Zhang 2022-02-22 205
7e77dbcb9661c3 Tonghao Zhang 2022-02-22 206 if (!tb[TCA_SKBEDIT_QUEUE_MAPPING] ||
7e77dbcb9661c3 Tonghao Zhang 2022-02-22 207 !tb[TCA_SKBEDIT_QUEUE_MAPPING_MAX]) {
7e77dbcb9661c3 Tonghao Zhang 2022-02-22 208 NL_SET_ERR_MSG_MOD(extack, "Missing required range of queue_mapping.");
7e77dbcb9661c3 Tonghao Zhang 2022-02-22 209 return -EINVAL;
7e77dbcb9661c3 Tonghao Zhang 2022-02-22 210 }
7e77dbcb9661c3 Tonghao Zhang 2022-02-22 211
7e77dbcb9661c3 Tonghao Zhang 2022-02-22 212 queue_mapping_max =
7e77dbcb9661c3 Tonghao Zhang 2022-02-22 213 nla_data(tb[TCA_SKBEDIT_QUEUE_MAPPING_MAX]);
7e77dbcb9661c3 Tonghao Zhang 2022-02-22 214 if (*queue_mapping_max < *queue_mapping) {
7e77dbcb9661c3 Tonghao Zhang 2022-02-22 215 NL_SET_ERR_MSG_MOD(extack, "The range of queue_mapping is invalid, max < min.");
7e77dbcb9661c3 Tonghao Zhang 2022-02-22 216 return -EINVAL;
7e77dbcb9661c3 Tonghao Zhang 2022-02-22 217 }
7e77dbcb9661c3 Tonghao Zhang 2022-02-22 218
7e77dbcb9661c3 Tonghao Zhang 2022-02-22 219 mapping_mod = *queue_mapping_max - *queue_mapping + 1;
7e77dbcb9661c3 Tonghao Zhang 2022-02-22 220 flags |= mapping_hash_type;
7e77dbcb9661c3 Tonghao Zhang 2022-02-22 221 }
e7e3728bd776d1 Qiaobin Fu 2018-07-01 222 if (*pure_flags & SKBEDIT_F_INHERITDSFIELD)
e7e3728bd776d1 Qiaobin Fu 2018-07-01 223 flags |= SKBEDIT_F_INHERITDSFIELD;
e7e3728bd776d1 Qiaobin Fu 2018-07-01 224 }
e7e3728bd776d1 Qiaobin Fu 2018-07-01 225
ca9b0e27e072be Alexander Duyck 2008-09-12 226 parm = nla_data(tb[TCA_SKBEDIT_PARMS]);
7be8ef2cdbfe41 Dmytro Linkin 2019-08-01 227 index = parm->index;
7be8ef2cdbfe41 Dmytro Linkin 2019-08-01 228 err = tcf_idr_check_alloc(tn, &index, a, bind);
0190c1d452a91c Vlad Buslov 2018-07-05 229 if (err < 0)
0190c1d452a91c Vlad Buslov 2018-07-05 230 return err;
0190c1d452a91c Vlad Buslov 2018-07-05 231 exists = err;
5e1567aeb7fe0c Jamal Hadi Salim 2016-05-10 232 if (exists && bind)
5e1567aeb7fe0c Jamal Hadi Salim 2016-05-10 233 return 0;
5e1567aeb7fe0c Jamal Hadi Salim 2016-05-10 234
5e1567aeb7fe0c Jamal Hadi Salim 2016-05-10 235 if (!flags) {
af5d01842fe1fb Roman Mashak 2018-05-11 236 if (exists)
65a206c01e8e7f Chris Mi 2017-08-30 237 tcf_idr_release(*a, bind);
0190c1d452a91c Vlad Buslov 2018-07-05 238 else
7be8ef2cdbfe41 Dmytro Linkin 2019-08-01 239 tcf_idr_cleanup(tn, index);
5e1567aeb7fe0c Jamal Hadi Salim 2016-05-10 240 return -EINVAL;
5e1567aeb7fe0c Jamal Hadi Salim 2016-05-10 241 }
5e1567aeb7fe0c Jamal Hadi Salim 2016-05-10 242
5e1567aeb7fe0c Jamal Hadi Salim 2016-05-10 243 if (!exists) {
7be8ef2cdbfe41 Dmytro Linkin 2019-08-01 244 ret = tcf_idr_create(tn, index, est, a,
40bd094d65fc9f Baowen Zheng 2021-12-17 245 &act_skbedit_ops, bind, true, act_flags);
0190c1d452a91c Vlad Buslov 2018-07-05 246 if (ret) {
7be8ef2cdbfe41 Dmytro Linkin 2019-08-01 247 tcf_idr_cleanup(tn, index);
86062033feb8a1 WANG Cong 2014-02-11 248 return ret;
0190c1d452a91c Vlad Buslov 2018-07-05 249 }
ca9b0e27e072be Alexander Duyck 2008-09-12 250
a85a970af265f1 WANG Cong 2016-07-25 251 d = to_skbedit(*a);
ca9b0e27e072be Alexander Duyck 2008-09-12 252 ret = ACT_P_CREATED;
ca9b0e27e072be Alexander Duyck 2008-09-12 253 } else {
a85a970af265f1 WANG Cong 2016-07-25 254 d = to_skbedit(*a);
695176bfe5dec2 Cong Wang 2021-07-29 255 if (!(act_flags & TCA_ACT_FLAGS_REPLACE)) {
65a206c01e8e7f Chris Mi 2017-08-30 256 tcf_idr_release(*a, bind);
ca9b0e27e072be Alexander Duyck 2008-09-12 257 return -EEXIST;
ca9b0e27e072be Alexander Duyck 2008-09-12 258 }
4e8ddd7f1758ca Vlad Buslov 2018-07-05 259 }
ec7727bb24b01e Davide Caratti 2019-03-20 260 err = tcf_action_check_ctrlact(parm->action, tp, &goto_ch, extack);
ec7727bb24b01e Davide Caratti 2019-03-20 261 if (err < 0)
ec7727bb24b01e Davide Caratti 2019-03-20 262 goto release_idr;
ca9b0e27e072be Alexander Duyck 2008-09-12 263
c749cdda9089eb Davide Caratti 2018-07-11 264 params_new = kzalloc(sizeof(*params_new), GFP_KERNEL);
c749cdda9089eb Davide Caratti 2018-07-11 265 if (unlikely(!params_new)) {
ec7727bb24b01e Davide Caratti 2019-03-20 266 err = -ENOMEM;
ec7727bb24b01e Davide Caratti 2019-03-20 267 goto put_chain;
c749cdda9089eb Davide Caratti 2018-07-11 268 }
ca9b0e27e072be Alexander Duyck 2008-09-12 269
c749cdda9089eb Davide Caratti 2018-07-11 270 params_new->flags = flags;
ca9b0e27e072be Alexander Duyck 2008-09-12 271 if (flags & SKBEDIT_F_PRIORITY)
c749cdda9089eb Davide Caratti 2018-07-11 @272 params_new->priority = *priority;
7e77dbcb9661c3 Tonghao Zhang 2022-02-22 273 if (flags & SKBEDIT_F_QUEUE_MAPPING) {
c749cdda9089eb Davide Caratti 2018-07-11 274 params_new->queue_mapping = *queue_mapping;
7e77dbcb9661c3 Tonghao Zhang 2022-02-22 275 params_new->mapping_mod = mapping_mod;
7e77dbcb9661c3 Tonghao Zhang 2022-02-22 276 }
1c55d62e77fa16 jamal 2009-10-15 277 if (flags & SKBEDIT_F_MARK)
c749cdda9089eb Davide Caratti 2018-07-11 @278 params_new->mark = *mark;
ff202ee1ed8f03 Jamal Hadi Salim 2016-07-02 279 if (flags & SKBEDIT_F_PTYPE)
c749cdda9089eb Davide Caratti 2018-07-11 @280 params_new->ptype = *ptype;
4fe77d82ef80c7 Antonio Quartulli 2016-10-24 281 /* default behaviour is to use all the bits */
c749cdda9089eb Davide Caratti 2018-07-11 282 params_new->mask = 0xffffffff;
4fe77d82ef80c7 Antonio Quartulli 2016-10-24 283 if (flags & SKBEDIT_F_MASK)
c749cdda9089eb Davide Caratti 2018-07-11 @284 params_new->mask = *mask;
1c55d62e77fa16 jamal 2009-10-15 285
6d7a8df6dfe4d6 Vlad Buslov 2018-09-03 286 spin_lock_bh(&d->tcf_lock);
ec7727bb24b01e Davide Caratti 2019-03-20 287 goto_ch = tcf_action_set_ctrlact(*a, parm->action, goto_ch);
445d3749315f34 Paul E. McKenney 2019-09-23 288 params_new = rcu_replace_pointer(d->params, params_new,
6d7a8df6dfe4d6 Vlad Buslov 2018-09-03 289 lockdep_is_held(&d->tcf_lock));
6d7a8df6dfe4d6 Vlad Buslov 2018-09-03 290 spin_unlock_bh(&d->tcf_lock);
6d7a8df6dfe4d6 Vlad Buslov 2018-09-03 291 if (params_new)
6d7a8df6dfe4d6 Vlad Buslov 2018-09-03 292 kfree_rcu(params_new, rcu);
ec7727bb24b01e Davide Caratti 2019-03-20 293 if (goto_ch)
ec7727bb24b01e Davide Caratti 2019-03-20 294 tcf_chain_put_by_act(goto_ch);
ca9b0e27e072be Alexander Duyck 2008-09-12 295
ca9b0e27e072be Alexander Duyck 2008-09-12 296 return ret;
ec7727bb24b01e Davide Caratti 2019-03-20 297 put_chain:
ec7727bb24b01e Davide Caratti 2019-03-20 298 if (goto_ch)
ec7727bb24b01e Davide Caratti 2019-03-20 299 tcf_chain_put_by_act(goto_ch);
ec7727bb24b01e Davide Caratti 2019-03-20 300 release_idr:
ec7727bb24b01e Davide Caratti 2019-03-20 301 tcf_idr_release(*a, bind);
ec7727bb24b01e Davide Caratti 2019-03-20 302 return err;
ca9b0e27e072be Alexander Duyck 2008-09-12 303 }
ca9b0e27e072be Alexander Duyck 2008-09-12 304
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [net-next v9 2/2] net: sched: support hash/classid/cpuid selecting tx queue
@ 2022-02-24 1:47 kernel test robot
0 siblings, 0 replies; 3+ messages in thread
From: kernel test robot @ 2022-02-24 1:47 UTC (permalink / raw)
To: kbuild
[-- Attachment #1: Type: text/plain, Size: 52510 bytes --]
CC: llvm(a)lists.linux.dev
CC: kbuild-all(a)lists.01.org
BCC: lkp(a)intel.com
In-Reply-To: <20220222112326.15070-3-xiangxia.m.yue@gmail.com>
References: <20220222112326.15070-3-xiangxia.m.yue@gmail.com>
TO: xiangxia.m.yue(a)gmail.com
TO: netdev(a)vger.kernel.org
CC: Tonghao Zhang <xiangxia.m.yue@gmail.com>
CC: Jamal Hadi Salim <jhs@mojatatu.com>
CC: Cong Wang <xiyou.wangcong@gmail.com>
CC: Jiri Pirko <jiri@resnulli.us>
CC: Jakub Kicinski <kuba@kernel.org>
CC: Jonathan Lemon <jonathan.lemon@gmail.com>
CC: Eric Dumazet <edumazet@google.com>
CC: Alexander Lobakin <alobakin@pm.me>
CC: Paolo Abeni <pabeni@redhat.com>
CC: Talal Ahmad <talalahmad@google.com>
CC: Kevin Hao <haokexin@gmail.com>
CC: Ilias Apalodimas <ilias.apalodimas@linaro.org>
CC: Kees Cook <keescook@chromium.org>
CC: Kumar Kartikeya Dwivedi <memxor@gmail.com>
CC: Antoine Tenart <atenart@kernel.org>
CC: Wei Wang <weiwan@google.com>
CC: Arnd Bergmann <arnd@arndb.de>
Hi,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on net-next/master]
url: https://github.com/0day-ci/linux/commits/xiangxia-m-yue-gmail-com/net-sched-allow-user-to-select-txqueue/20220222-192425
base: https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git 7b779cc8846ae0bfdad8eca7b751109a5cf930b7
:::::: branch date: 2 days ago
:::::: commit date: 2 days ago
config: riscv-randconfig-c006-20220221 (https://download.01.org/0day-ci/archive/20220224/202202240907.8oGPVZlw-lkp(a)intel.com/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project d271fc04d5b97b12e6b797c6067d3c96a8d7470e)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# install riscv cross compiling tool for clang build
# apt-get install binutils-riscv64-linux-gnu
# https://github.com/0day-ci/linux/commit/7e77dbcb9661c380571e649ee555f715938b5326
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review xiangxia-m-yue-gmail-com/net-sched-allow-user-to-select-txqueue/20220222-192425
git checkout 7e77dbcb9661c380571e649ee555f715938b5326
# save the config file to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=riscv clang-analyzer
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
clang-analyzer warnings: (new ones prefixed by >>)
^~~~~~~~~~~~~~~~~~
fs/ext4/extents_status.c:1336:9: note: '?' condition is false
fs/ext4/extents_status.c:1337:9: note: Assuming the condition is false
len2 = ext4_es_end(es) > end ? ext4_es_end(es) - end : 0;
^~~~~~~~~~~~~~~~~~~~~
fs/ext4/extents_status.c:1337:9: note: '?' condition is false
fs/ext4/extents_status.c:1338:6: note: 'len1' is <= 0
if (len1 > 0)
^~~~
fs/ext4/extents_status.c:1338:2: note: Taking false branch
if (len1 > 0)
^
fs/ext4/extents_status.c:1340:6: note: 'len2' is <= 0
if (len2 > 0) {
^~~~
fs/ext4/extents_status.c:1340:2: note: Taking false branch
if (len2 > 0) {
^
fs/ext4/extents_status.c:1378:6: note: 'len1' is <= 0
if (len1 > 0) {
^~~~
fs/ext4/extents_status.c:1378:2: note: Taking false branch
if (len1 > 0) {
^
fs/ext4/extents_status.c:1389:9: note: 'es' is non-null
while (es && ext4_es_end(es) <= end) {
^~
fs/ext4/extents_status.c:1389:9: note: Left side of '&&' is true
fs/ext4/extents_status.c:1389:15: note: Assuming the condition is true
while (es && ext4_es_end(es) <= end) {
^~~~~~~~~~~~~~~~~~~~~~
fs/ext4/extents_status.c:1389:2: note: Loop condition is true. Entering loop body
while (es && ext4_es_end(es) <= end) {
^
fs/ext4/extents_status.c:1390:7: note: 'count_reserved' is true
if (count_reserved)
^~~~~~~~~~~~~~
fs/ext4/extents_status.c:1390:3: note: Taking true branch
if (count_reserved)
^
fs/ext4/extents_status.c:1391:4: note: Calling 'count_rsvd'
count_rsvd(inode, es->es_lblk, es->es_len, es, &rc);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fs/ext4/extents_status.c:1058:2: note: Taking true branch
if (!ext4_es_is_delonly(es))
^
fs/ext4/extents_status.c:1059:3: note: Returning without writing to 'rc->partial'
return;
^
fs/ext4/extents_status.c:1391:4: note: Returning from 'count_rsvd'
count_rsvd(inode, es->es_lblk, es->es_len, es, &rc);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fs/ext4/extents_status.c:1395:7: note: Assuming 'node' is null
if (!node) {
^~~~~
fs/ext4/extents_status.c:1395:3: note: Taking true branch
if (!node) {
^
fs/ext4/extents_status.c:1397:4: note: Execution continues on line 1402
break;
^
fs/ext4/extents_status.c:1402:6: note: 'es' is null
if (es && es->es_lblk < end + 1) {
^~
fs/ext4/extents_status.c:1402:9: note: Left side of '&&' is false
if (es && es->es_lblk < end + 1) {
^
fs/ext4/extents_status.c:1417:6: note: 'count_reserved' is true
if (count_reserved)
^~~~~~~~~~~~~~
fs/ext4/extents_status.c:1417:2: note: Taking true branch
if (count_reserved)
^
fs/ext4/extents_status.c:1418:15: note: Calling 'get_rsvd'
*reserved = get_rsvd(inode, end, es, &rc);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fs/ext4/extents_status.c:1187:6: note: Assuming field 's_cluster_ratio' is > 1
if (sbi->s_cluster_ratio > 1) {
^~~~~~~~~~~~~~~~~~~~~~~~
fs/ext4/extents_status.c:1187:2: note: Taking true branch
if (sbi->s_cluster_ratio > 1) {
^
fs/ext4/extents_status.c:1189:7: note: Branch condition evaluates to a garbage value
if (rc->partial)
^~~~~~~~~~~
Suppressed 10 warnings (3 in non-user code, 7 with check filters).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
9 warnings generated.
Suppressed 9 warnings (2 in non-user code, 7 with check filters).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
9 warnings generated.
Suppressed 9 warnings (2 in non-user code, 7 with check filters).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
2 warnings generated.
Suppressed 2 warnings (2 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
9 warnings generated.
Suppressed 9 warnings (2 in non-user code, 7 with check filters).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
13 warnings generated.
>> net/sched/act_skbedit.c:272:26: warning: Dereference of null pointer (loaded from variable 'priority') [clang-analyzer-core.NullDereference]
params_new->priority = *priority;
^~~~~~~~~
net/sched/act_skbedit.c:147:18: note: 'priority' initialized to a null pointer value
u32 flags = 0, *priority = NULL, *mark = NULL, *mask = NULL;
^~~~~~~~
net/sched/act_skbedit.c:154:6: note: Assuming 'nla' is not equal to NULL
if (nla == NULL)
^~~~~~~~~~~
net/sched/act_skbedit.c:154:2: note: Taking false branch
if (nla == NULL)
^
net/sched/act_skbedit.c:157:8: note: Calling 'nla_parse_nested_deprecated'
err = nla_parse_nested_deprecated(tb, TCA_SKBEDIT_MAX, nla,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/net/netlink.h:1231:9: note: Assigning value, which participates in a condition later
return __nla_parse(tb, maxtype, nla_data(nla), nla_len(nla), policy,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/sched/act_skbedit.c:157:8: note: Returning from 'nla_parse_nested_deprecated'
err = nla_parse_nested_deprecated(tb, TCA_SKBEDIT_MAX, nla,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/sched/act_skbedit.c:159:6: note: Assuming 'err' is >= 0
if (err < 0)
^~~~~~~
net/sched/act_skbedit.c:159:2: note: Taking false branch
if (err < 0)
^
net/sched/act_skbedit.c:162:6: note: Assuming the condition is false
if (tb[TCA_SKBEDIT_PARMS] == NULL)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/sched/act_skbedit.c:162:2: note: Taking false branch
if (tb[TCA_SKBEDIT_PARMS] == NULL)
^
net/sched/act_skbedit.c:165:6: note: Assuming the condition is false
if (tb[TCA_SKBEDIT_PRIORITY] != NULL) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/sched/act_skbedit.c:165:2: note: Taking false branch
if (tb[TCA_SKBEDIT_PRIORITY] != NULL) {
^
net/sched/act_skbedit.c:170:6: note: Assuming the condition is true
if (tb[TCA_SKBEDIT_QUEUE_MAPPING] != NULL) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/sched/act_skbedit.c:170:2: note: Taking true branch
if (tb[TCA_SKBEDIT_QUEUE_MAPPING] != NULL) {
^
net/sched/act_skbedit.c:175:6: note: Assuming the condition is false
if (tb[TCA_SKBEDIT_PTYPE] != NULL) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/sched/act_skbedit.c:175:2: note: Taking false branch
if (tb[TCA_SKBEDIT_PTYPE] != NULL) {
^
net/sched/act_skbedit.c:182:6: note: Assuming the condition is false
if (tb[TCA_SKBEDIT_MARK] != NULL) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/sched/act_skbedit.c:182:2: note: Taking false branch
if (tb[TCA_SKBEDIT_MARK] != NULL) {
^
net/sched/act_skbedit.c:187:6: note: Assuming the condition is false
if (tb[TCA_SKBEDIT_MASK] != NULL) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/sched/act_skbedit.c:187:2: note: Taking false branch
if (tb[TCA_SKBEDIT_MASK] != NULL) {
^
net/sched/act_skbedit.c:192:6: note: Assuming the condition is true
if (tb[TCA_SKBEDIT_FLAGS] != NULL) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/sched/act_skbedit.c:192:2: note: Taking true branch
if (tb[TCA_SKBEDIT_FLAGS] != NULL) {
^
net/sched/act_skbedit.c:197:7: note: Assuming 'mapping_hash_type' is not equal to 0
if (mapping_hash_type) {
^~~~~~~~~~~~~~~~~
net/sched/act_skbedit.c:197:3: note: Taking true branch
if (mapping_hash_type) {
^
net/sched/act_skbedit.c:201:8: note: Assuming the condition is false
if (mapping_hash_type & (mapping_hash_type - 1)) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/sched/act_skbedit.c:201:4: note: Taking false branch
if (mapping_hash_type & (mapping_hash_type - 1)) {
^
net/sched/act_skbedit.c:206:8: note: Left side of '||' is false
if (!tb[TCA_SKBEDIT_QUEUE_MAPPING] ||
^
net/sched/act_skbedit.c:207:8: note: Assuming the condition is false
!tb[TCA_SKBEDIT_QUEUE_MAPPING_MAX]) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/sched/act_skbedit.c:206:4: note: Taking false branch
if (!tb[TCA_SKBEDIT_QUEUE_MAPPING] ||
^
net/sched/act_skbedit.c:214:8: note: Assuming the condition is false
if (*queue_mapping_max < *queue_mapping) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/sched/act_skbedit.c:214:4: note: Taking false branch
if (*queue_mapping_max < *queue_mapping) {
^
net/sched/act_skbedit.c:222:7: note: Assuming the condition is false
if (*pure_flags & SKBEDIT_F_INHERITDSFIELD)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/sched/act_skbedit.c:222:3: note: Taking false branch
if (*pure_flags & SKBEDIT_F_INHERITDSFIELD)
^
net/sched/act_skbedit.c:229:6: note: Assuming 'err' is >= 0
if (err < 0)
^~~~~~~
net/sched/act_skbedit.c:229:2: note: Taking false branch
if (err < 0)
^
net/sched/act_skbedit.c:232:6: note: Assuming 'exists' is true
if (exists && bind)
^~~~~~
net/sched/act_skbedit.c:232:6: note: Left side of '&&' is true
net/sched/act_skbedit.c:232:16: note: Assuming 'bind' is false
if (exists && bind)
^~~~
net/sched/act_skbedit.c:232:2: note: Taking false branch
if (exists && bind)
^
net/sched/act_skbedit.c:235:7: note: 'flags' is not equal to 0
if (!flags) {
^~~~~
net/sched/act_skbedit.c:235:2: note: Taking false branch
if (!flags) {
^
net/sched/act_skbedit.c:243:7: note: 'exists' is true
if (!exists) {
^~~~~~
net/sched/act_skbedit.c:243:2: note: Taking false branch
if (!exists) {
^
net/sched/act_skbedit.c:255:7: note: Assuming the condition is false
if (!(act_flags & TCA_ACT_FLAGS_REPLACE)) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/sched/act_skbedit.c:255:3: note: Taking false branch
if (!(act_flags & TCA_ACT_FLAGS_REPLACE)) {
^
net/sched/act_skbedit.c:261:6: note: Assuming 'err' is >= 0
if (err < 0)
^~~~~~~
net/sched/act_skbedit.c:261:2: note: Taking false branch
if (err < 0)
^
net/sched/act_skbedit.c:265:15: note: Assuming 'params_new' is non-null
if (unlikely(!params_new)) {
^
include/linux/compiler.h:78:42: note: expanded from macro 'unlikely'
# define unlikely(x) __builtin_expect(!!(x), 0)
^
net/sched/act_skbedit.c:265:2: note: Taking false branch
if (unlikely(!params_new)) {
^
net/sched/act_skbedit.c:271:6: note: Assuming the condition is true
if (flags & SKBEDIT_F_PRIORITY)
^~~~~~~~~~~~~~~~~~~~~~~~~~
net/sched/act_skbedit.c:271:2: note: Taking true branch
if (flags & SKBEDIT_F_PRIORITY)
^
net/sched/act_skbedit.c:272:26: note: Dereference of null pointer (loaded from variable 'priority')
params_new->priority = *priority;
^~~~~~~~~
>> net/sched/act_skbedit.c:278:22: warning: Dereference of null pointer (loaded from variable 'mark') [clang-analyzer-core.NullDereference]
params_new->mark = *mark;
^~~~~
net/sched/act_skbedit.c:147:36: note: 'mark' initialized to a null pointer value
u32 flags = 0, *priority = NULL, *mark = NULL, *mask = NULL;
^~~~
net/sched/act_skbedit.c:154:6: note: Assuming 'nla' is not equal to NULL
if (nla == NULL)
^~~~~~~~~~~
net/sched/act_skbedit.c:154:2: note: Taking false branch
if (nla == NULL)
^
net/sched/act_skbedit.c:157:8: note: Calling 'nla_parse_nested_deprecated'
err = nla_parse_nested_deprecated(tb, TCA_SKBEDIT_MAX, nla,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/net/netlink.h:1231:9: note: Assigning value, which participates in a condition later
return __nla_parse(tb, maxtype, nla_data(nla), nla_len(nla), policy,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/sched/act_skbedit.c:157:8: note: Returning from 'nla_parse_nested_deprecated'
err = nla_parse_nested_deprecated(tb, TCA_SKBEDIT_MAX, nla,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/sched/act_skbedit.c:159:6: note: Assuming 'err' is >= 0
if (err < 0)
^~~~~~~
net/sched/act_skbedit.c:159:2: note: Taking false branch
if (err < 0)
^
net/sched/act_skbedit.c:162:6: note: Assuming the condition is false
if (tb[TCA_SKBEDIT_PARMS] == NULL)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/sched/act_skbedit.c:162:2: note: Taking false branch
if (tb[TCA_SKBEDIT_PARMS] == NULL)
^
net/sched/act_skbedit.c:165:6: note: Assuming the condition is false
if (tb[TCA_SKBEDIT_PRIORITY] != NULL) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/sched/act_skbedit.c:165:2: note: Taking false branch
if (tb[TCA_SKBEDIT_PRIORITY] != NULL) {
^
net/sched/act_skbedit.c:170:6: note: Assuming the condition is true
if (tb[TCA_SKBEDIT_QUEUE_MAPPING] != NULL) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/sched/act_skbedit.c:170:2: note: Taking true branch
if (tb[TCA_SKBEDIT_QUEUE_MAPPING] != NULL) {
^
net/sched/act_skbedit.c:175:6: note: Assuming the condition is false
if (tb[TCA_SKBEDIT_PTYPE] != NULL) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/sched/act_skbedit.c:175:2: note: Taking false branch
if (tb[TCA_SKBEDIT_PTYPE] != NULL) {
^
net/sched/act_skbedit.c:182:6: note: Assuming the condition is false
if (tb[TCA_SKBEDIT_MARK] != NULL) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/sched/act_skbedit.c:182:2: note: Taking false branch
if (tb[TCA_SKBEDIT_MARK] != NULL) {
^
net/sched/act_skbedit.c:187:6: note: Assuming the condition is false
if (tb[TCA_SKBEDIT_MASK] != NULL) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/sched/act_skbedit.c:187:2: note: Taking false branch
if (tb[TCA_SKBEDIT_MASK] != NULL) {
^
net/sched/act_skbedit.c:192:6: note: Assuming the condition is true
if (tb[TCA_SKBEDIT_FLAGS] != NULL) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/sched/act_skbedit.c:192:2: note: Taking true branch
if (tb[TCA_SKBEDIT_FLAGS] != NULL) {
^
net/sched/act_skbedit.c:197:7: note: Assuming 'mapping_hash_type' is not equal to 0
if (mapping_hash_type) {
^~~~~~~~~~~~~~~~~
net/sched/act_skbedit.c:197:3: note: Taking true branch
if (mapping_hash_type) {
^
net/sched/act_skbedit.c:201:8: note: Assuming the condition is false
if (mapping_hash_type & (mapping_hash_type - 1)) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/sched/act_skbedit.c:201:4: note: Taking false branch
if (mapping_hash_type & (mapping_hash_type - 1)) {
^
net/sched/act_skbedit.c:206:8: note: Left side of '||' is false
if (!tb[TCA_SKBEDIT_QUEUE_MAPPING] ||
^
net/sched/act_skbedit.c:207:8: note: Assuming the condition is false
!tb[TCA_SKBEDIT_QUEUE_MAPPING_MAX]) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/sched/act_skbedit.c:206:4: note: Taking false branch
if (!tb[TCA_SKBEDIT_QUEUE_MAPPING] ||
^
net/sched/act_skbedit.c:214:8: note: Assuming the condition is false
if (*queue_mapping_max < *queue_mapping) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/sched/act_skbedit.c:214:4: note: Taking false branch
if (*queue_mapping_max < *queue_mapping) {
^
net/sched/act_skbedit.c:222:7: note: Assuming the condition is false
if (*pure_flags & SKBEDIT_F_INHERITDSFIELD)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/sched/act_skbedit.c:222:3: note: Taking false branch
if (*pure_flags & SKBEDIT_F_INHERITDSFIELD)
^
net/sched/act_skbedit.c:229:6: note: Assuming 'err' is >= 0
if (err < 0)
^~~~~~~
net/sched/act_skbedit.c:229:2: note: Taking false branch
if (err < 0)
^
net/sched/act_skbedit.c:232:6: note: Assuming 'exists' is true
if (exists && bind)
^~~~~~
net/sched/act_skbedit.c:232:6: note: Left side of '&&' is true
net/sched/act_skbedit.c:232:16: note: Assuming 'bind' is false
if (exists && bind)
^~~~
net/sched/act_skbedit.c:232:2: note: Taking false branch
if (exists && bind)
^
net/sched/act_skbedit.c:235:7: note: 'flags' is not equal to 0
if (!flags) {
^~~~~
net/sched/act_skbedit.c:235:2: note: Taking false branch
if (!flags) {
^
net/sched/act_skbedit.c:243:7: note: 'exists' is true
if (!exists) {
^~~~~~
net/sched/act_skbedit.c:243:2: note: Taking false branch
if (!exists) {
^
net/sched/act_skbedit.c:255:7: note: Assuming the condition is false
if (!(act_flags & TCA_ACT_FLAGS_REPLACE)) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/sched/act_skbedit.c:255:3: note: Taking false branch
if (!(act_flags & TCA_ACT_FLAGS_REPLACE)) {
^
net/sched/act_skbedit.c:261:6: note: Assuming 'err' is >= 0
if (err < 0)
^~~~~~~
net/sched/act_skbedit.c:261:2: note: Taking false branch
if (err < 0)
^
net/sched/act_skbedit.c:265:15: note: Assuming 'params_new' is non-null
if (unlikely(!params_new)) {
^
include/linux/compiler.h:78:42: note: expanded from macro 'unlikely'
# define unlikely(x) __builtin_expect(!!(x), 0)
^
net/sched/act_skbedit.c:265:2: note: Taking false branch
if (unlikely(!params_new)) {
^
net/sched/act_skbedit.c:271:6: note: Assuming the condition is false
if (flags & SKBEDIT_F_PRIORITY)
^~~~~~~~~~~~~~~~~~~~~~~~~~
net/sched/act_skbedit.c:271:2: note: Taking false branch
if (flags & SKBEDIT_F_PRIORITY)
^
net/sched/act_skbedit.c:273:6: note: Assuming the condition is false
if (flags & SKBEDIT_F_QUEUE_MAPPING) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/sched/act_skbedit.c:273:2: note: Taking false branch
if (flags & SKBEDIT_F_QUEUE_MAPPING) {
^
net/sched/act_skbedit.c:277:6: note: Assuming the condition is true
if (flags & SKBEDIT_F_MARK)
^~~~~~~~~~~~~~~~~~~~~~
net/sched/act_skbedit.c:277:2: note: Taking true branch
if (flags & SKBEDIT_F_MARK)
^
net/sched/act_skbedit.c:278:22: note: Dereference of null pointer (loaded from variable 'mark')
params_new->mark = *mark;
^~~~~
>> net/sched/act_skbedit.c:280:23: warning: Dereference of null pointer (loaded from variable 'ptype') [clang-analyzer-core.NullDereference]
params_new->ptype = *ptype;
^~~~~~
net/sched/act_skbedit.c:148:30: note: 'ptype' initialized to a null pointer value
u16 *queue_mapping = NULL, *ptype = NULL;
^~~~~
net/sched/act_skbedit.c:154:6: note: Assuming 'nla' is not equal to NULL
if (nla == NULL)
^~~~~~~~~~~
net/sched/act_skbedit.c:154:2: note: Taking false branch
if (nla == NULL)
^
net/sched/act_skbedit.c:157:8: note: Calling 'nla_parse_nested_deprecated'
err = nla_parse_nested_deprecated(tb, TCA_SKBEDIT_MAX, nla,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/net/netlink.h:1231:9: note: Assigning value, which participates in a condition later
return __nla_parse(tb, maxtype, nla_data(nla), nla_len(nla), policy,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/sched/act_skbedit.c:157:8: note: Returning from 'nla_parse_nested_deprecated'
err = nla_parse_nested_deprecated(tb, TCA_SKBEDIT_MAX, nla,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/sched/act_skbedit.c:159:6: note: Assuming 'err' is >= 0
if (err < 0)
^~~~~~~
net/sched/act_skbedit.c:159:2: note: Taking false branch
if (err < 0)
^
net/sched/act_skbedit.c:162:6: note: Assuming the condition is false
if (tb[TCA_SKBEDIT_PARMS] == NULL)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/sched/act_skbedit.c:162:2: note: Taking false branch
if (tb[TCA_SKBEDIT_PARMS] == NULL)
^
net/sched/act_skbedit.c:165:6: note: Assuming the condition is false
if (tb[TCA_SKBEDIT_PRIORITY] != NULL) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/sched/act_skbedit.c:165:2: note: Taking false branch
if (tb[TCA_SKBEDIT_PRIORITY] != NULL) {
^
net/sched/act_skbedit.c:170:6: note: Assuming the condition is true
if (tb[TCA_SKBEDIT_QUEUE_MAPPING] != NULL) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/sched/act_skbedit.c:170:2: note: Taking true branch
if (tb[TCA_SKBEDIT_QUEUE_MAPPING] != NULL) {
^
net/sched/act_skbedit.c:175:6: note: Assuming the condition is false
if (tb[TCA_SKBEDIT_PTYPE] != NULL) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/sched/act_skbedit.c:175:2: note: Taking false branch
if (tb[TCA_SKBEDIT_PTYPE] != NULL) {
^
net/sched/act_skbedit.c:182:6: note: Assuming the condition is false
if (tb[TCA_SKBEDIT_MARK] != NULL) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/sched/act_skbedit.c:182:2: note: Taking false branch
if (tb[TCA_SKBEDIT_MARK] != NULL) {
^
net/sched/act_skbedit.c:187:6: note: Assuming the condition is false
if (tb[TCA_SKBEDIT_MASK] != NULL) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/sched/act_skbedit.c:187:2: note: Taking false branch
if (tb[TCA_SKBEDIT_MASK] != NULL) {
^
net/sched/act_skbedit.c:192:6: note: Assuming the condition is true
if (tb[TCA_SKBEDIT_FLAGS] != NULL) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/sched/act_skbedit.c:192:2: note: Taking true branch
if (tb[TCA_SKBEDIT_FLAGS] != NULL) {
^
net/sched/act_skbedit.c:197:7: note: Assuming 'mapping_hash_type' is not equal to 0
if (mapping_hash_type) {
^~~~~~~~~~~~~~~~~
net/sched/act_skbedit.c:197:3: note: Taking true branch
if (mapping_hash_type) {
^
net/sched/act_skbedit.c:201:8: note: Assuming the condition is false
if (mapping_hash_type & (mapping_hash_type - 1)) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/sched/act_skbedit.c:201:4: note: Taking false branch
if (mapping_hash_type & (mapping_hash_type - 1)) {
^
net/sched/act_skbedit.c:206:8: note: Left side of '||' is false
if (!tb[TCA_SKBEDIT_QUEUE_MAPPING] ||
^
net/sched/act_skbedit.c:207:8: note: Assuming the condition is false
!tb[TCA_SKBEDIT_QUEUE_MAPPING_MAX]) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/sched/act_skbedit.c:206:4: note: Taking false branch
if (!tb[TCA_SKBEDIT_QUEUE_MAPPING] ||
^
net/sched/act_skbedit.c:214:8: note: Assuming the condition is false
if (*queue_mapping_max < *queue_mapping) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/sched/act_skbedit.c:214:4: note: Taking false branch
if (*queue_mapping_max < *queue_mapping) {
^
net/sched/act_skbedit.c:222:7: note: Assuming the condition is false
if (*pure_flags & SKBEDIT_F_INHERITDSFIELD)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/sched/act_skbedit.c:222:3: note: Taking false branch
if (*pure_flags & SKBEDIT_F_INHERITDSFIELD)
^
net/sched/act_skbedit.c:229:6: note: Assuming 'err' is >= 0
if (err < 0)
^~~~~~~
net/sched/act_skbedit.c:229:2: note: Taking false branch
if (err < 0)
^
net/sched/act_skbedit.c:232:6: note: Assuming 'exists' is true
if (exists && bind)
^~~~~~
net/sched/act_skbedit.c:232:6: note: Left side of '&&' is true
net/sched/act_skbedit.c:232:16: note: Assuming 'bind' is false
if (exists && bind)
^~~~
net/sched/act_skbedit.c:232:2: note: Taking false branch
if (exists && bind)
^
net/sched/act_skbedit.c:235:7: note: 'flags' is not equal to 0
if (!flags) {
^~~~~
net/sched/act_skbedit.c:235:2: note: Taking false branch
if (!flags) {
^
net/sched/act_skbedit.c:243:7: note: 'exists' is true
if (!exists) {
^~~~~~
net/sched/act_skbedit.c:243:2: note: Taking false branch
if (!exists) {
^
net/sched/act_skbedit.c:255:7: note: Assuming the condition is false
if (!(act_flags & TCA_ACT_FLAGS_REPLACE)) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/sched/act_skbedit.c:255:3: note: Taking false branch
if (!(act_flags & TCA_ACT_FLAGS_REPLACE)) {
^
net/sched/act_skbedit.c:261:6: note: Assuming 'err' is >= 0
if (err < 0)
^~~~~~~
net/sched/act_skbedit.c:261:2: note: Taking false branch
if (err < 0)
^
net/sched/act_skbedit.c:265:15: note: Assuming 'params_new' is non-null
if (unlikely(!params_new)) {
^
include/linux/compiler.h:78:42: note: expanded from macro 'unlikely'
# define unlikely(x) __builtin_expect(!!(x), 0)
^
net/sched/act_skbedit.c:265:2: note: Taking false branch
if (unlikely(!params_new)) {
^
net/sched/act_skbedit.c:271:6: note: Assuming the condition is false
if (flags & SKBEDIT_F_PRIORITY)
^~~~~~~~~~~~~~~~~~~~~~~~~~
net/sched/act_skbedit.c:271:2: note: Taking false branch
if (flags & SKBEDIT_F_PRIORITY)
^
net/sched/act_skbedit.c:273:6: note: Assuming the condition is false
if (flags & SKBEDIT_F_QUEUE_MAPPING) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/sched/act_skbedit.c:273:2: note: Taking false branch
if (flags & SKBEDIT_F_QUEUE_MAPPING) {
^
net/sched/act_skbedit.c:277:6: note: Assuming the condition is false
if (flags & SKBEDIT_F_MARK)
^~~~~~~~~~~~~~~~~~~~~~
net/sched/act_skbedit.c:277:2: note: Taking false branch
if (flags & SKBEDIT_F_MARK)
^
net/sched/act_skbedit.c:279:6: note: Assuming the condition is true
if (flags & SKBEDIT_F_PTYPE)
^~~~~~~~~~~~~~~~~~~~~~~
net/sched/act_skbedit.c:279:2: note: Taking true branch
if (flags & SKBEDIT_F_PTYPE)
^
net/sched/act_skbedit.c:280:23: note: Dereference of null pointer (loaded from variable 'ptype')
params_new->ptype = *ptype;
^~~~~~
>> net/sched/act_skbedit.c:284:22: warning: Dereference of null pointer (loaded from variable 'mask') [clang-analyzer-core.NullDereference]
params_new->mask = *mask;
^~~~~
net/sched/act_skbedit.c:147:50: note: 'mask' initialized to a null pointer value
u32 flags = 0, *priority = NULL, *mark = NULL, *mask = NULL;
^~~~
net/sched/act_skbedit.c:154:6: note: Assuming 'nla' is not equal to NULL
if (nla == NULL)
^~~~~~~~~~~
net/sched/act_skbedit.c:154:2: note: Taking false branch
if (nla == NULL)
^
net/sched/act_skbedit.c:157:8: note: Calling 'nla_parse_nested_deprecated'
err = nla_parse_nested_deprecated(tb, TCA_SKBEDIT_MAX, nla,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/net/netlink.h:1231:9: note: Assigning value, which participates in a condition later
return __nla_parse(tb, maxtype, nla_data(nla), nla_len(nla), policy,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/sched/act_skbedit.c:157:8: note: Returning from 'nla_parse_nested_deprecated'
err = nla_parse_nested_deprecated(tb, TCA_SKBEDIT_MAX, nla,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/sched/act_skbedit.c:159:6: note: Assuming 'err' is >= 0
if (err < 0)
^~~~~~~
net/sched/act_skbedit.c:159:2: note: Taking false branch
if (err < 0)
^
net/sched/act_skbedit.c:162:6: note: Assuming the condition is false
if (tb[TCA_SKBEDIT_PARMS] == NULL)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/sched/act_skbedit.c:162:2: note: Taking false branch
if (tb[TCA_SKBEDIT_PARMS] == NULL)
^
net/sched/act_skbedit.c:165:6: note: Assuming the condition is false
if (tb[TCA_SKBEDIT_PRIORITY] != NULL) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/sched/act_skbedit.c:165:2: note: Taking false branch
if (tb[TCA_SKBEDIT_PRIORITY] != NULL) {
^
net/sched/act_skbedit.c:170:6: note: Assuming the condition is true
if (tb[TCA_SKBEDIT_QUEUE_MAPPING] != NULL) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/sched/act_skbedit.c:170:2: note: Taking true branch
if (tb[TCA_SKBEDIT_QUEUE_MAPPING] != NULL) {
^
net/sched/act_skbedit.c:175:6: note: Assuming the condition is false
if (tb[TCA_SKBEDIT_PTYPE] != NULL) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/sched/act_skbedit.c:175:2: note: Taking false branch
if (tb[TCA_SKBEDIT_PTYPE] != NULL) {
^
net/sched/act_skbedit.c:182:6: note: Assuming the condition is false
if (tb[TCA_SKBEDIT_MARK] != NULL) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/sched/act_skbedit.c:182:2: note: Taking false branch
if (tb[TCA_SKBEDIT_MARK] != NULL) {
^
net/sched/act_skbedit.c:187:6: note: Assuming the condition is false
if (tb[TCA_SKBEDIT_MASK] != NULL) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/sched/act_skbedit.c:187:2: note: Taking false branch
if (tb[TCA_SKBEDIT_MASK] != NULL) {
^
net/sched/act_skbedit.c:192:6: note: Assuming the condition is true
if (tb[TCA_SKBEDIT_FLAGS] != NULL) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/sched/act_skbedit.c:192:2: note: Taking true branch
if (tb[TCA_SKBEDIT_FLAGS] != NULL) {
^
net/sched/act_skbedit.c:197:7: note: Assuming 'mapping_hash_type' is not equal to 0
if (mapping_hash_type) {
^~~~~~~~~~~~~~~~~
net/sched/act_skbedit.c:197:3: note: Taking true branch
if (mapping_hash_type) {
^
net/sched/act_skbedit.c:201:8: note: Assuming the condition is false
if (mapping_hash_type & (mapping_hash_type - 1)) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/sched/act_skbedit.c:201:4: note: Taking false branch
if (mapping_hash_type & (mapping_hash_type - 1)) {
^
net/sched/act_skbedit.c:206:8: note: Left side of '||' is false
if (!tb[TCA_SKBEDIT_QUEUE_MAPPING] ||
^
net/sched/act_skbedit.c:207:8: note: Assuming the condition is false
!tb[TCA_SKBEDIT_QUEUE_MAPPING_MAX]) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/sched/act_skbedit.c:206:4: note: Taking false branch
if (!tb[TCA_SKBEDIT_QUEUE_MAPPING] ||
^
net/sched/act_skbedit.c:214:8: note: Assuming the condition is false
if (*queue_mapping_max < *queue_mapping) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/sched/act_skbedit.c:214:4: note: Taking false branch
if (*queue_mapping_max < *queue_mapping) {
^
net/sched/act_skbedit.c:222:7: note: Assuming the condition is false
if (*pure_flags & SKBEDIT_F_INHERITDSFIELD)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/sched/act_skbedit.c:222:3: note: Taking false branch
if (*pure_flags & SKBEDIT_F_INHERITDSFIELD)
vim +/priority +272 net/sched/act_skbedit.c
ca9b0e27e072be Alexander Duyck 2008-09-12 134
c1b52739e45f59 Benjamin LaHaise 2013-01-14 135 static int tcf_skbedit_init(struct net *net, struct nlattr *nla,
a85a970af265f1 WANG Cong 2016-07-25 136 struct nlattr *est, struct tc_action **a,
abbb0d33632ce9 Vlad Buslov 2019-10-30 137 struct tcf_proto *tp, u32 act_flags,
789871bb2a0381 Vlad Buslov 2018-07-05 138 struct netlink_ext_ack *extack)
ca9b0e27e072be Alexander Duyck 2008-09-12 139 {
ddf97ccdd7cb7e WANG Cong 2016-02-22 140 struct tc_action_net *tn = net_generic(net, skbedit_net_id);
695176bfe5dec2 Cong Wang 2021-07-29 141 bool bind = act_flags & TCA_ACT_FLAGS_BIND;
6d7a8df6dfe4d6 Vlad Buslov 2018-09-03 142 struct tcf_skbedit_params *params_new;
ca9b0e27e072be Alexander Duyck 2008-09-12 143 struct nlattr *tb[TCA_SKBEDIT_MAX + 1];
ec7727bb24b01e Davide Caratti 2019-03-20 144 struct tcf_chain *goto_ch = NULL;
ca9b0e27e072be Alexander Duyck 2008-09-12 145 struct tc_skbedit *parm;
ca9b0e27e072be Alexander Duyck 2008-09-12 146 struct tcf_skbedit *d;
4fe77d82ef80c7 Antonio Quartulli 2016-10-24 147 u32 flags = 0, *priority = NULL, *mark = NULL, *mask = NULL;
ff202ee1ed8f03 Jamal Hadi Salim 2016-07-02 148 u16 *queue_mapping = NULL, *ptype = NULL;
7e77dbcb9661c3 Tonghao Zhang 2022-02-22 149 u16 mapping_mod = 1;
b2313077ed0db3 WANG Cong 2016-06-13 150 bool exists = false;
b2313077ed0db3 WANG Cong 2016-06-13 151 int ret = 0, err;
7be8ef2cdbfe41 Dmytro Linkin 2019-08-01 152 u32 index;
ca9b0e27e072be Alexander Duyck 2008-09-12 153
ca9b0e27e072be Alexander Duyck 2008-09-12 154 if (nla == NULL)
ca9b0e27e072be Alexander Duyck 2008-09-12 155 return -EINVAL;
ca9b0e27e072be Alexander Duyck 2008-09-12 156
8cb081746c031f Johannes Berg 2019-04-26 157 err = nla_parse_nested_deprecated(tb, TCA_SKBEDIT_MAX, nla,
8cb081746c031f Johannes Berg 2019-04-26 158 skbedit_policy, NULL);
ca9b0e27e072be Alexander Duyck 2008-09-12 159 if (err < 0)
ca9b0e27e072be Alexander Duyck 2008-09-12 160 return err;
ca9b0e27e072be Alexander Duyck 2008-09-12 161
ca9b0e27e072be Alexander Duyck 2008-09-12 162 if (tb[TCA_SKBEDIT_PARMS] == NULL)
ca9b0e27e072be Alexander Duyck 2008-09-12 163 return -EINVAL;
ca9b0e27e072be Alexander Duyck 2008-09-12 164
ca9b0e27e072be Alexander Duyck 2008-09-12 165 if (tb[TCA_SKBEDIT_PRIORITY] != NULL) {
ca9b0e27e072be Alexander Duyck 2008-09-12 166 flags |= SKBEDIT_F_PRIORITY;
ca9b0e27e072be Alexander Duyck 2008-09-12 167 priority = nla_data(tb[TCA_SKBEDIT_PRIORITY]);
ca9b0e27e072be Alexander Duyck 2008-09-12 168 }
ca9b0e27e072be Alexander Duyck 2008-09-12 169
ca9b0e27e072be Alexander Duyck 2008-09-12 170 if (tb[TCA_SKBEDIT_QUEUE_MAPPING] != NULL) {
ca9b0e27e072be Alexander Duyck 2008-09-12 171 flags |= SKBEDIT_F_QUEUE_MAPPING;
ca9b0e27e072be Alexander Duyck 2008-09-12 172 queue_mapping = nla_data(tb[TCA_SKBEDIT_QUEUE_MAPPING]);
ca9b0e27e072be Alexander Duyck 2008-09-12 173 }
1c55d62e77fa16 jamal 2009-10-15 174
ff202ee1ed8f03 Jamal Hadi Salim 2016-07-02 175 if (tb[TCA_SKBEDIT_PTYPE] != NULL) {
ff202ee1ed8f03 Jamal Hadi Salim 2016-07-02 176 ptype = nla_data(tb[TCA_SKBEDIT_PTYPE]);
ff202ee1ed8f03 Jamal Hadi Salim 2016-07-02 177 if (!skb_pkt_type_ok(*ptype))
ff202ee1ed8f03 Jamal Hadi Salim 2016-07-02 178 return -EINVAL;
ff202ee1ed8f03 Jamal Hadi Salim 2016-07-02 179 flags |= SKBEDIT_F_PTYPE;
ff202ee1ed8f03 Jamal Hadi Salim 2016-07-02 180 }
ff202ee1ed8f03 Jamal Hadi Salim 2016-07-02 181
1c55d62e77fa16 jamal 2009-10-15 182 if (tb[TCA_SKBEDIT_MARK] != NULL) {
1c55d62e77fa16 jamal 2009-10-15 183 flags |= SKBEDIT_F_MARK;
1c55d62e77fa16 jamal 2009-10-15 184 mark = nla_data(tb[TCA_SKBEDIT_MARK]);
1c55d62e77fa16 jamal 2009-10-15 185 }
1c55d62e77fa16 jamal 2009-10-15 186
4fe77d82ef80c7 Antonio Quartulli 2016-10-24 187 if (tb[TCA_SKBEDIT_MASK] != NULL) {
4fe77d82ef80c7 Antonio Quartulli 2016-10-24 188 flags |= SKBEDIT_F_MASK;
4fe77d82ef80c7 Antonio Quartulli 2016-10-24 189 mask = nla_data(tb[TCA_SKBEDIT_MASK]);
4fe77d82ef80c7 Antonio Quartulli 2016-10-24 190 }
4fe77d82ef80c7 Antonio Quartulli 2016-10-24 191
e7e3728bd776d1 Qiaobin Fu 2018-07-01 192 if (tb[TCA_SKBEDIT_FLAGS] != NULL) {
e7e3728bd776d1 Qiaobin Fu 2018-07-01 193 u64 *pure_flags = nla_data(tb[TCA_SKBEDIT_FLAGS]);
7e77dbcb9661c3 Tonghao Zhang 2022-02-22 194 u64 mapping_hash_type;
e7e3728bd776d1 Qiaobin Fu 2018-07-01 195
7e77dbcb9661c3 Tonghao Zhang 2022-02-22 196 mapping_hash_type = *pure_flags & SKBEDIT_F_TXQ_HASH_MASK;
7e77dbcb9661c3 Tonghao Zhang 2022-02-22 197 if (mapping_hash_type) {
7e77dbcb9661c3 Tonghao Zhang 2022-02-22 198 u16 *queue_mapping_max;
7e77dbcb9661c3 Tonghao Zhang 2022-02-22 199
7e77dbcb9661c3 Tonghao Zhang 2022-02-22 200 /* Hash types are mutually exclusive. */
7e77dbcb9661c3 Tonghao Zhang 2022-02-22 201 if (mapping_hash_type & (mapping_hash_type - 1)) {
7e77dbcb9661c3 Tonghao Zhang 2022-02-22 202 NL_SET_ERR_MSG_MOD(extack, "Multi types of hash are specified.");
7e77dbcb9661c3 Tonghao Zhang 2022-02-22 203 return -EINVAL;
7e77dbcb9661c3 Tonghao Zhang 2022-02-22 204 }
7e77dbcb9661c3 Tonghao Zhang 2022-02-22 205
7e77dbcb9661c3 Tonghao Zhang 2022-02-22 206 if (!tb[TCA_SKBEDIT_QUEUE_MAPPING] ||
7e77dbcb9661c3 Tonghao Zhang 2022-02-22 207 !tb[TCA_SKBEDIT_QUEUE_MAPPING_MAX]) {
7e77dbcb9661c3 Tonghao Zhang 2022-02-22 208 NL_SET_ERR_MSG_MOD(extack, "Missing required range of queue_mapping.");
7e77dbcb9661c3 Tonghao Zhang 2022-02-22 209 return -EINVAL;
7e77dbcb9661c3 Tonghao Zhang 2022-02-22 210 }
7e77dbcb9661c3 Tonghao Zhang 2022-02-22 211
7e77dbcb9661c3 Tonghao Zhang 2022-02-22 212 queue_mapping_max =
7e77dbcb9661c3 Tonghao Zhang 2022-02-22 213 nla_data(tb[TCA_SKBEDIT_QUEUE_MAPPING_MAX]);
7e77dbcb9661c3 Tonghao Zhang 2022-02-22 214 if (*queue_mapping_max < *queue_mapping) {
7e77dbcb9661c3 Tonghao Zhang 2022-02-22 215 NL_SET_ERR_MSG_MOD(extack, "The range of queue_mapping is invalid, max < min.");
7e77dbcb9661c3 Tonghao Zhang 2022-02-22 216 return -EINVAL;
7e77dbcb9661c3 Tonghao Zhang 2022-02-22 217 }
7e77dbcb9661c3 Tonghao Zhang 2022-02-22 218
7e77dbcb9661c3 Tonghao Zhang 2022-02-22 219 mapping_mod = *queue_mapping_max - *queue_mapping + 1;
7e77dbcb9661c3 Tonghao Zhang 2022-02-22 220 flags |= mapping_hash_type;
7e77dbcb9661c3 Tonghao Zhang 2022-02-22 221 }
e7e3728bd776d1 Qiaobin Fu 2018-07-01 222 if (*pure_flags & SKBEDIT_F_INHERITDSFIELD)
e7e3728bd776d1 Qiaobin Fu 2018-07-01 223 flags |= SKBEDIT_F_INHERITDSFIELD;
e7e3728bd776d1 Qiaobin Fu 2018-07-01 224 }
e7e3728bd776d1 Qiaobin Fu 2018-07-01 225
ca9b0e27e072be Alexander Duyck 2008-09-12 226 parm = nla_data(tb[TCA_SKBEDIT_PARMS]);
7be8ef2cdbfe41 Dmytro Linkin 2019-08-01 227 index = parm->index;
7be8ef2cdbfe41 Dmytro Linkin 2019-08-01 228 err = tcf_idr_check_alloc(tn, &index, a, bind);
0190c1d452a91c Vlad Buslov 2018-07-05 229 if (err < 0)
0190c1d452a91c Vlad Buslov 2018-07-05 230 return err;
0190c1d452a91c Vlad Buslov 2018-07-05 231 exists = err;
5e1567aeb7fe0c Jamal Hadi Salim 2016-05-10 232 if (exists && bind)
5e1567aeb7fe0c Jamal Hadi Salim 2016-05-10 233 return 0;
5e1567aeb7fe0c Jamal Hadi Salim 2016-05-10 234
5e1567aeb7fe0c Jamal Hadi Salim 2016-05-10 235 if (!flags) {
af5d01842fe1fb Roman Mashak 2018-05-11 236 if (exists)
65a206c01e8e7f Chris Mi 2017-08-30 237 tcf_idr_release(*a, bind);
0190c1d452a91c Vlad Buslov 2018-07-05 238 else
7be8ef2cdbfe41 Dmytro Linkin 2019-08-01 239 tcf_idr_cleanup(tn, index);
5e1567aeb7fe0c Jamal Hadi Salim 2016-05-10 240 return -EINVAL;
5e1567aeb7fe0c Jamal Hadi Salim 2016-05-10 241 }
5e1567aeb7fe0c Jamal Hadi Salim 2016-05-10 242
5e1567aeb7fe0c Jamal Hadi Salim 2016-05-10 243 if (!exists) {
7be8ef2cdbfe41 Dmytro Linkin 2019-08-01 244 ret = tcf_idr_create(tn, index, est, a,
40bd094d65fc9f Baowen Zheng 2021-12-17 245 &act_skbedit_ops, bind, true, act_flags);
0190c1d452a91c Vlad Buslov 2018-07-05 246 if (ret) {
7be8ef2cdbfe41 Dmytro Linkin 2019-08-01 247 tcf_idr_cleanup(tn, index);
86062033feb8a1 WANG Cong 2014-02-11 248 return ret;
0190c1d452a91c Vlad Buslov 2018-07-05 249 }
ca9b0e27e072be Alexander Duyck 2008-09-12 250
a85a970af265f1 WANG Cong 2016-07-25 251 d = to_skbedit(*a);
ca9b0e27e072be Alexander Duyck 2008-09-12 252 ret = ACT_P_CREATED;
ca9b0e27e072be Alexander Duyck 2008-09-12 253 } else {
a85a970af265f1 WANG Cong 2016-07-25 254 d = to_skbedit(*a);
695176bfe5dec2 Cong Wang 2021-07-29 255 if (!(act_flags & TCA_ACT_FLAGS_REPLACE)) {
65a206c01e8e7f Chris Mi 2017-08-30 256 tcf_idr_release(*a, bind);
ca9b0e27e072be Alexander Duyck 2008-09-12 257 return -EEXIST;
ca9b0e27e072be Alexander Duyck 2008-09-12 258 }
4e8ddd7f1758ca Vlad Buslov 2018-07-05 259 }
ec7727bb24b01e Davide Caratti 2019-03-20 260 err = tcf_action_check_ctrlact(parm->action, tp, &goto_ch, extack);
ec7727bb24b01e Davide Caratti 2019-03-20 261 if (err < 0)
ec7727bb24b01e Davide Caratti 2019-03-20 262 goto release_idr;
ca9b0e27e072be Alexander Duyck 2008-09-12 263
c749cdda9089eb Davide Caratti 2018-07-11 264 params_new = kzalloc(sizeof(*params_new), GFP_KERNEL);
c749cdda9089eb Davide Caratti 2018-07-11 265 if (unlikely(!params_new)) {
ec7727bb24b01e Davide Caratti 2019-03-20 266 err = -ENOMEM;
ec7727bb24b01e Davide Caratti 2019-03-20 267 goto put_chain;
c749cdda9089eb Davide Caratti 2018-07-11 268 }
ca9b0e27e072be Alexander Duyck 2008-09-12 269
c749cdda9089eb Davide Caratti 2018-07-11 270 params_new->flags = flags;
ca9b0e27e072be Alexander Duyck 2008-09-12 271 if (flags & SKBEDIT_F_PRIORITY)
c749cdda9089eb Davide Caratti 2018-07-11 @272 params_new->priority = *priority;
7e77dbcb9661c3 Tonghao Zhang 2022-02-22 273 if (flags & SKBEDIT_F_QUEUE_MAPPING) {
c749cdda9089eb Davide Caratti 2018-07-11 274 params_new->queue_mapping = *queue_mapping;
7e77dbcb9661c3 Tonghao Zhang 2022-02-22 275 params_new->mapping_mod = mapping_mod;
7e77dbcb9661c3 Tonghao Zhang 2022-02-22 276 }
1c55d62e77fa16 jamal 2009-10-15 277 if (flags & SKBEDIT_F_MARK)
c749cdda9089eb Davide Caratti 2018-07-11 @278 params_new->mark = *mark;
ff202ee1ed8f03 Jamal Hadi Salim 2016-07-02 279 if (flags & SKBEDIT_F_PTYPE)
c749cdda9089eb Davide Caratti 2018-07-11 @280 params_new->ptype = *ptype;
4fe77d82ef80c7 Antonio Quartulli 2016-10-24 281 /* default behaviour is to use all the bits */
c749cdda9089eb Davide Caratti 2018-07-11 282 params_new->mask = 0xffffffff;
4fe77d82ef80c7 Antonio Quartulli 2016-10-24 283 if (flags & SKBEDIT_F_MASK)
c749cdda9089eb Davide Caratti 2018-07-11 @284 params_new->mask = *mask;
1c55d62e77fa16 jamal 2009-10-15 285
6d7a8df6dfe4d6 Vlad Buslov 2018-09-03 286 spin_lock_bh(&d->tcf_lock);
ec7727bb24b01e Davide Caratti 2019-03-20 287 goto_ch = tcf_action_set_ctrlact(*a, parm->action, goto_ch);
445d3749315f34 Paul E. McKenney 2019-09-23 288 params_new = rcu_replace_pointer(d->params, params_new,
6d7a8df6dfe4d6 Vlad Buslov 2018-09-03 289 lockdep_is_held(&d->tcf_lock));
6d7a8df6dfe4d6 Vlad Buslov 2018-09-03 290 spin_unlock_bh(&d->tcf_lock);
6d7a8df6dfe4d6 Vlad Buslov 2018-09-03 291 if (params_new)
6d7a8df6dfe4d6 Vlad Buslov 2018-09-03 292 kfree_rcu(params_new, rcu);
ec7727bb24b01e Davide Caratti 2019-03-20 293 if (goto_ch)
ec7727bb24b01e Davide Caratti 2019-03-20 294 tcf_chain_put_by_act(goto_ch);
ca9b0e27e072be Alexander Duyck 2008-09-12 295
ca9b0e27e072be Alexander Duyck 2008-09-12 296 return ret;
ec7727bb24b01e Davide Caratti 2019-03-20 297 put_chain:
ec7727bb24b01e Davide Caratti 2019-03-20 298 if (goto_ch)
ec7727bb24b01e Davide Caratti 2019-03-20 299 tcf_chain_put_by_act(goto_ch);
ec7727bb24b01e Davide Caratti 2019-03-20 300 release_idr:
ec7727bb24b01e Davide Caratti 2019-03-20 301 tcf_idr_release(*a, bind);
ec7727bb24b01e Davide Caratti 2019-03-20 302 return err;
ca9b0e27e072be Alexander Duyck 2008-09-12 303 }
ca9b0e27e072be Alexander Duyck 2008-09-12 304
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
^ permalink raw reply [flat|nested] 3+ messages in thread
* [net-next v9 2/2] net: sched: support hash/classid/cpuid selecting tx queue
2022-02-22 11:23 [net-next v9 0/2] net: sched: allow user to select txqueue xiangxia.m.yue
@ 2022-02-22 11:23 ` xiangxia.m.yue
0 siblings, 0 replies; 3+ messages in thread
From: xiangxia.m.yue @ 2022-02-22 11:23 UTC (permalink / raw)
To: netdev
Cc: Tonghao Zhang, Jamal Hadi Salim, Cong Wang, Jiri Pirko,
David S. Miller, Jakub Kicinski, Jonathan Lemon, Eric Dumazet,
Alexander Lobakin, Paolo Abeni, Talal Ahmad, Kevin Hao,
Ilias Apalodimas, Kees Cook, Kumar Kartikeya Dwivedi,
Antoine Tenart, Wei Wang, Arnd Bergmann
From: Tonghao Zhang <xiangxia.m.yue@gmail.com>
This patch allows users to pick queue_mapping, range
from A to B. And users can use skbhash, cgroup classid
and cpuid to pick Tx queues. Then we can load balance
packets from A to B tx queue. The range is an unsigned 16bit
value in decimal format.
$ tc filter ... action skbedit queue_mapping skbhash A B
"skbedit queue_mapping QUEUE_MAPPING" (from "man 8 tc-skbedit")
is enhanced with flags:
* SKBEDIT_F_TXQ_SKBHASH
* SKBEDIT_F_TXQ_CLASSID
* SKBEDIT_F_TXQ_CPUID
Use skb->hash, cgroup classid, or cpuid to distribute packets.
Then same range of tx queues can be shared for different flows,
cgroups, or CPUs in a variety of scenarios.
+----+ +----+ +----+
| P1 | | P2 | | Pn |
+----+ +----+ +----+
| | |
+-----------+-----------+
|
| clsact/skbedit
| MQ
v
+-----------+-----------+
| q0 | qn | qm
v v v
HTB/FQ FIFO ... FIFO
For example:
If P1 sends out packets to different Pods on other
host, and we want distribute flows from qn - qm. Then we can use
the SKBEDIT_F_TXQ_HASH skb->hash as hash.
If P1 pinned on CPU1, and P2 pinned CPU2 share the txqueue range,
we can use the cpuid as hash to select txqueue.
setup commands:
$ NETDEV=eth0
$ ip netns add n1
$ ip link add ipv1 link $NETDEV type ipvlan mode l2
$ ip link set ipv1 netns n1
$ ip netns exec n1 ifconfig ipv1 2.2.2.100/24 up
$ tc qdisc add dev $NETDEV clsact
$ tc filter add dev $NETDEV egress protocol ip prio 1 \
flower skip_hw src_ip 2.2.2.100 action skbedit queue_mapping skbhash 2 6
$ tc qdisc add dev $NETDEV handle 1: root mq
$ tc qdisc add dev $NETDEV parent 1:1 handle 2: htb
$ tc class add dev $NETDEV parent 2: classid 2:1 htb rate 100kbit
$ tc class add dev $NETDEV parent 2: classid 2:2 htb rate 200kbit
$ tc qdisc add dev $NETDEV parent 1:2 tbf rate 100mbit burst 100mb latency 1
$ tc qdisc add dev $NETDEV parent 1:3 pfifo
$ tc qdisc add dev $NETDEV parent 1:4 pfifo
$ tc qdisc add dev $NETDEV parent 1:5 pfifo
$ tc qdisc add dev $NETDEV parent 1:6 pfifo
$ tc qdisc add dev $NETDEV parent 1:7 pfifo
$ ip netns exec n1 iperf3 -c 2.2.2.1 -i 1 -t 10 -P 10
pick txqueue from 2 - 6:
$ ethtool -S $NETDEV | grep -i tx_queue_[0-9]_bytes
tx_queue_0_bytes: 42
tx_queue_1_bytes: 0
tx_queue_2_bytes: 11442586444
tx_queue_3_bytes: 7383615334
tx_queue_4_bytes: 3981365579
tx_queue_5_bytes: 3983235051
tx_queue_6_bytes: 6706236461
tx_queue_7_bytes: 42
tx_queue_8_bytes: 0
tx_queue_9_bytes: 0
txqueues 2 - 6 are mapped to classid 1:3 - 1:7
$ tc -s class show dev $NETDEV
...
class mq 1:3 root leaf 8002:
Sent 11949133672 bytes 7929798 pkt (dropped 0, overlimits 0 requeues 0)
backlog 0b 0p requeues 0
class mq 1:4 root leaf 8003:
Sent 7710449050 bytes 5117279 pkt (dropped 0, overlimits 0 requeues 0)
backlog 0b 0p requeues 0
class mq 1:5 root leaf 8004:
Sent 4157648675 bytes 2758990 pkt (dropped 0, overlimits 0 requeues 0)
backlog 0b 0p requeues 0
class mq 1:6 root leaf 8005:
Sent 4159632195 bytes 2759990 pkt (dropped 0, overlimits 0 requeues 0)
backlog 0b 0p requeues 0
class mq 1:7 root leaf 8006:
Sent 7003169603 bytes 4646912 pkt (dropped 0, overlimits 0 requeues 0)
backlog 0b 0p requeues 0
...
Cc: Jamal Hadi Salim <jhs@mojatatu.com>
Cc: Cong Wang <xiyou.wangcong@gmail.com>
Cc: Jiri Pirko <jiri@resnulli.us>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Jakub Kicinski <kuba@kernel.org>
Cc: Jonathan Lemon <jonathan.lemon@gmail.com>
Cc: Eric Dumazet <edumazet@google.com>
Cc: Alexander Lobakin <alobakin@pm.me>
Cc: Paolo Abeni <pabeni@redhat.com>
Cc: Talal Ahmad <talalahmad@google.com>
Cc: Kevin Hao <haokexin@gmail.com>
Cc: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Cc: Kees Cook <keescook@chromium.org>
Cc: Kumar Kartikeya Dwivedi <memxor@gmail.com>
Cc: Antoine Tenart <atenart@kernel.org>
Cc: Wei Wang <weiwan@google.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Tonghao Zhang <xiangxia.m.yue@gmail.com>
---
include/net/tc_act/tc_skbedit.h | 1 +
include/uapi/linux/tc_act/tc_skbedit.h | 8 +++
net/sched/act_skbedit.c | 78 +++++++++++++++++++++++++-
3 files changed, 84 insertions(+), 3 deletions(-)
diff --git a/include/net/tc_act/tc_skbedit.h b/include/net/tc_act/tc_skbedit.h
index 00bfee70609e..ee96e0fa6566 100644
--- a/include/net/tc_act/tc_skbedit.h
+++ b/include/net/tc_act/tc_skbedit.h
@@ -17,6 +17,7 @@ struct tcf_skbedit_params {
u32 mark;
u32 mask;
u16 queue_mapping;
+ u16 mapping_mod;
u16 ptype;
struct rcu_head rcu;
};
diff --git a/include/uapi/linux/tc_act/tc_skbedit.h b/include/uapi/linux/tc_act/tc_skbedit.h
index 800e93377218..5ea1438a4d88 100644
--- a/include/uapi/linux/tc_act/tc_skbedit.h
+++ b/include/uapi/linux/tc_act/tc_skbedit.h
@@ -29,6 +29,13 @@
#define SKBEDIT_F_PTYPE 0x8
#define SKBEDIT_F_MASK 0x10
#define SKBEDIT_F_INHERITDSFIELD 0x20
+#define SKBEDIT_F_TXQ_SKBHASH 0x40
+#define SKBEDIT_F_TXQ_CLASSID 0x80
+#define SKBEDIT_F_TXQ_CPUID 0x100
+
+#define SKBEDIT_F_TXQ_HASH_MASK (SKBEDIT_F_TXQ_SKBHASH | \
+ SKBEDIT_F_TXQ_CLASSID | \
+ SKBEDIT_F_TXQ_CPUID)
struct tc_skbedit {
tc_gen;
@@ -45,6 +52,7 @@ enum {
TCA_SKBEDIT_PTYPE,
TCA_SKBEDIT_MASK,
TCA_SKBEDIT_FLAGS,
+ TCA_SKBEDIT_QUEUE_MAPPING_MAX,
__TCA_SKBEDIT_MAX
};
#define TCA_SKBEDIT_MAX (__TCA_SKBEDIT_MAX - 1)
diff --git a/net/sched/act_skbedit.c b/net/sched/act_skbedit.c
index d5799b4fc499..4c209689f8de 100644
--- a/net/sched/act_skbedit.c
+++ b/net/sched/act_skbedit.c
@@ -10,6 +10,7 @@
#include <linux/kernel.h>
#include <linux/skbuff.h>
#include <linux/rtnetlink.h>
+#include <net/cls_cgroup.h>
#include <net/netlink.h>
#include <net/pkt_sched.h>
#include <net/ip.h>
@@ -23,6 +24,38 @@
static unsigned int skbedit_net_id;
static struct tc_action_ops act_skbedit_ops;
+static u16 tcf_skbedit_hash(struct tcf_skbedit_params *params,
+ struct sk_buff *skb)
+{
+ u32 mapping_hash_type = params->flags & SKBEDIT_F_TXQ_HASH_MASK;
+ u16 queue_mapping = params->queue_mapping;
+ u16 mapping_mod = params->mapping_mod;
+ u32 hash = 0;
+
+ switch (mapping_hash_type) {
+ case SKBEDIT_F_TXQ_CLASSID:
+ hash = task_get_classid(skb);
+ break;
+ case SKBEDIT_F_TXQ_SKBHASH:
+ hash = skb_get_hash(skb);
+ break;
+ case SKBEDIT_F_TXQ_CPUID:
+ hash = raw_smp_processor_id();
+ break;
+ case 0:
+ /* Hash type isn't specified. In this case:
+ * hash % mapping_mod == 0
+ */
+ break;
+ default:
+ net_warn_ratelimited("The type of queue_mapping hash is not supported. 0x%x\n",
+ mapping_hash_type);
+ }
+
+ queue_mapping = queue_mapping + hash % mapping_mod;
+ return netdev_cap_txqueue(skb->dev, queue_mapping);
+}
+
static int tcf_skbedit_act(struct sk_buff *skb, const struct tc_action *a,
struct tcf_result *res)
{
@@ -62,7 +95,7 @@ static int tcf_skbedit_act(struct sk_buff *skb, const struct tc_action *a,
#ifdef CONFIG_NET_EGRESS
netdev_xmit_skip_txqueue(true);
#endif
- skb_set_queue_mapping(skb, params->queue_mapping);
+ skb_set_queue_mapping(skb, tcf_skbedit_hash(params, skb));
}
if (params->flags & SKBEDIT_F_MARK) {
skb->mark &= ~params->mask;
@@ -96,6 +129,7 @@ static const struct nla_policy skbedit_policy[TCA_SKBEDIT_MAX + 1] = {
[TCA_SKBEDIT_PTYPE] = { .len = sizeof(u16) },
[TCA_SKBEDIT_MASK] = { .len = sizeof(u32) },
[TCA_SKBEDIT_FLAGS] = { .len = sizeof(u64) },
+ [TCA_SKBEDIT_QUEUE_MAPPING_MAX] = { .len = sizeof(u16) },
};
static int tcf_skbedit_init(struct net *net, struct nlattr *nla,
@@ -112,6 +146,7 @@ static int tcf_skbedit_init(struct net *net, struct nlattr *nla,
struct tcf_skbedit *d;
u32 flags = 0, *priority = NULL, *mark = NULL, *mask = NULL;
u16 *queue_mapping = NULL, *ptype = NULL;
+ u16 mapping_mod = 1;
bool exists = false;
int ret = 0, err;
u32 index;
@@ -156,7 +191,34 @@ static int tcf_skbedit_init(struct net *net, struct nlattr *nla,
if (tb[TCA_SKBEDIT_FLAGS] != NULL) {
u64 *pure_flags = nla_data(tb[TCA_SKBEDIT_FLAGS]);
-
+ u64 mapping_hash_type;
+
+ mapping_hash_type = *pure_flags & SKBEDIT_F_TXQ_HASH_MASK;
+ if (mapping_hash_type) {
+ u16 *queue_mapping_max;
+
+ /* Hash types are mutually exclusive. */
+ if (mapping_hash_type & (mapping_hash_type - 1)) {
+ NL_SET_ERR_MSG_MOD(extack, "Multi types of hash are specified.");
+ return -EINVAL;
+ }
+
+ if (!tb[TCA_SKBEDIT_QUEUE_MAPPING] ||
+ !tb[TCA_SKBEDIT_QUEUE_MAPPING_MAX]) {
+ NL_SET_ERR_MSG_MOD(extack, "Missing required range of queue_mapping.");
+ return -EINVAL;
+ }
+
+ queue_mapping_max =
+ nla_data(tb[TCA_SKBEDIT_QUEUE_MAPPING_MAX]);
+ if (*queue_mapping_max < *queue_mapping) {
+ NL_SET_ERR_MSG_MOD(extack, "The range of queue_mapping is invalid, max < min.");
+ return -EINVAL;
+ }
+
+ mapping_mod = *queue_mapping_max - *queue_mapping + 1;
+ flags |= mapping_hash_type;
+ }
if (*pure_flags & SKBEDIT_F_INHERITDSFIELD)
flags |= SKBEDIT_F_INHERITDSFIELD;
}
@@ -208,8 +270,10 @@ static int tcf_skbedit_init(struct net *net, struct nlattr *nla,
params_new->flags = flags;
if (flags & SKBEDIT_F_PRIORITY)
params_new->priority = *priority;
- if (flags & SKBEDIT_F_QUEUE_MAPPING)
+ if (flags & SKBEDIT_F_QUEUE_MAPPING) {
params_new->queue_mapping = *queue_mapping;
+ params_new->mapping_mod = mapping_mod;
+ }
if (flags & SKBEDIT_F_MARK)
params_new->mark = *mark;
if (flags & SKBEDIT_F_PTYPE)
@@ -276,6 +340,13 @@ static int tcf_skbedit_dump(struct sk_buff *skb, struct tc_action *a,
goto nla_put_failure;
if (params->flags & SKBEDIT_F_INHERITDSFIELD)
pure_flags |= SKBEDIT_F_INHERITDSFIELD;
+ if (params->flags & SKBEDIT_F_TXQ_HASH_MASK) {
+ if (nla_put_u16(skb, TCA_SKBEDIT_QUEUE_MAPPING_MAX,
+ params->queue_mapping + params->mapping_mod - 1))
+ goto nla_put_failure;
+
+ pure_flags |= params->flags & SKBEDIT_F_TXQ_HASH_MASK;
+ }
if (pure_flags != 0 &&
nla_put(skb, TCA_SKBEDIT_FLAGS, sizeof(pure_flags), &pure_flags))
goto nla_put_failure;
@@ -325,6 +396,7 @@ static size_t tcf_skbedit_get_fill_size(const struct tc_action *act)
return nla_total_size(sizeof(struct tc_skbedit))
+ nla_total_size(sizeof(u32)) /* TCA_SKBEDIT_PRIORITY */
+ nla_total_size(sizeof(u16)) /* TCA_SKBEDIT_QUEUE_MAPPING */
+ + nla_total_size(sizeof(u16)) /* TCA_SKBEDIT_QUEUE_MAPPING_MAX */
+ nla_total_size(sizeof(u32)) /* TCA_SKBEDIT_MARK */
+ nla_total_size(sizeof(u16)) /* TCA_SKBEDIT_PTYPE */
+ nla_total_size(sizeof(u32)) /* TCA_SKBEDIT_MASK */
--
2.27.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-02-24 1:47 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-23 13:49 [net-next v9 2/2] net: sched: support hash/classid/cpuid selecting tx queue kernel test robot
-- strict thread matches above, loose matches on Subject: below --
2022-02-24 1:47 kernel test robot
2022-02-22 11:23 [net-next v9 0/2] net: sched: allow user to select txqueue xiangxia.m.yue
2022-02-22 11:23 ` [net-next v9 2/2] net: sched: support hash/classid/cpuid selecting tx queue xiangxia.m.yue
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.