CC: [email protected] CC: [email protected] In-Reply-To: <[email protected]> References: <[email protected]> TO: [email protected]
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/20220126-223333 base: https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git ab14f1802cfb2d7ca120bbf48e3ba6712314ffc3 :::::: branch date: 4 days ago :::::: commit date: 4 days ago config: i386-randconfig-c001 (https://download.01.org/0day-ci/archive/20220131/[email protected]/config) compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project f1c18acb07aa40f42b87b70462a6d1ab77a4825c) 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 # https://github.com/0day-ci/linux/commit/fca24c124e1091de78b0488a1528bc3b8515ce28 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/20220126-223333 git checkout fca24c124e1091de78b0488a1528bc3b8515ce28 # save the config file to linux build tree COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=i386 clang-analyzer If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot <[email protected]> clang-analyzer warnings: (new ones prefixed by >>) ^ fs/xfs/libxfs/xfs_dir2_data.c:154:6: note: Assuming field 'length' is 0 if (!bf[0].length) { ^~~~~~~~~~~~~ fs/xfs/libxfs/xfs_dir2_data.c:154:2: note: Taking true branch if (!bf[0].length) { ^ fs/xfs/libxfs/xfs_dir2_data.c:155:7: note: Assuming field 'offset' is 0 if (bf[0].offset) ^~~~~~~~~~~~ fs/xfs/libxfs/xfs_dir2_data.c:155:3: note: Taking false branch if (bf[0].offset) ^ fs/xfs/libxfs/xfs_dir2_data.c:159:6: note: Assuming field 'length' is 0 if (!bf[1].length) { ^~~~~~~~~~~~~ fs/xfs/libxfs/xfs_dir2_data.c:159:2: note: Taking true branch if (!bf[1].length) { ^ fs/xfs/libxfs/xfs_dir2_data.c:160:7: note: Assuming field 'offset' is 0 if (bf[1].offset) ^~~~~~~~~~~~ fs/xfs/libxfs/xfs_dir2_data.c:160:3: note: Taking false branch if (bf[1].offset) ^ fs/xfs/libxfs/xfs_dir2_data.c:164:6: note: Assuming field 'length' is 0 if (!bf[2].length) { ^~~~~~~~~~~~~ fs/xfs/libxfs/xfs_dir2_data.c:164:2: note: Taking true branch if (!bf[2].length) { ^ fs/xfs/libxfs/xfs_dir2_data.c:165:7: note: Assuming field 'offset' is 0 if (bf[2].offset) ^~~~~~~~~~~~ fs/xfs/libxfs/xfs_dir2_data.c:165:3: note: Taking false branch if (bf[2].offset) ^ fs/xfs/libxfs/xfs_dir2_data.c:170:6: note: Assuming the condition is false if (be16_to_cpu(bf[0].length) < be16_to_cpu(bf[1].length)) ^ include/linux/byteorder/generic.h:97:21: note: expanded from macro 'be16_to_cpu' #define be16_to_cpu __be16_to_cpu ^ include/uapi/linux/byteorder/little_endian.h:43:26: note: expanded from macro '__be16_to_cpu' #define __be16_to_cpu(x) __swab16((__force __u16)(__be16)(x)) ^ include/uapi/linux/swab.h:102:21: note: expanded from macro '__swab16' #define __swab16(x) (__u16)__builtin_bswap16((__u16)(x)) ^ fs/xfs/libxfs/xfs_dir2_data.c:170:2: note: Taking false branch if (be16_to_cpu(bf[0].length) < be16_to_cpu(bf[1].length)) ^ fs/xfs/libxfs/xfs_dir2_data.c:172:6: note: Assuming the condition is false if (be16_to_cpu(bf[1].length) < be16_to_cpu(bf[2].length)) ^ include/linux/byteorder/generic.h:97:21: note: expanded from macro 'be16_to_cpu' #define be16_to_cpu __be16_to_cpu ^ include/uapi/linux/byteorder/little_endian.h:43:26: note: expanded from macro '__be16_to_cpu' #define __be16_to_cpu(x) __swab16((__force __u16)(__be16)(x)) ^ include/uapi/linux/swab.h:102:21: note: expanded from macro '__swab16' #define __swab16(x) (__u16)__builtin_bswap16((__u16)(x)) ^ fs/xfs/libxfs/xfs_dir2_data.c:172:2: note: Taking false branch if (be16_to_cpu(bf[1].length) < be16_to_cpu(bf[2].length)) ^ fs/xfs/libxfs/xfs_dir2_data.c:177:9: note: Assuming 'offset' is >= 'end' while (offset < end) { ^~~~~~~~~~~~ fs/xfs/libxfs/xfs_dir2_data.c:177:2: note: Loop condition is false. Execution continues on line 252 while (offset < end) { ^ fs/xfs/libxfs/xfs_dir2_data.c:252:6: note: 'freeseen' is equal to 7 if (freeseen != 7) ^~~~~~~~ fs/xfs/libxfs/xfs_dir2_data.c:252:2: note: Taking false branch if (freeseen != 7) ^ fs/xfs/libxfs/xfs_dir2_data.c:254:6: note: Assuming the condition is true if (hdr->magic == cpu_to_be32(XFS_DIR2_BLOCK_MAGIC) || ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ fs/xfs/libxfs/xfs_dir2_data.c:254:54: note: Left side of '||' is true if (hdr->magic == cpu_to_be32(XFS_DIR2_BLOCK_MAGIC) || ^ fs/xfs/libxfs/xfs_dir2_data.c:256:27: note: Access to field 'count' results in a dereference of a null pointer (loaded from variable 'btp') for (i = stale = 0; i < be32_to_cpu(btp->count); i++) { ^ include/linux/byteorder/generic.h:95:21: note: expanded from macro 'be32_to_cpu' #define be32_to_cpu __be32_to_cpu ^ include/uapi/linux/byteorder/little_endian.h:41:58: note: expanded from macro '__be32_to_cpu' #define __be32_to_cpu(x) __swab32((__force __u32)(__be32)(x)) ^~ include/uapi/linux/swab.h:115:54: note: expanded from macro '__swab32' #define __swab32(x) (__u32)__builtin_bswap32((__u32)(x)) ^ Suppressed 1 warnings (1 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. 4 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 ca9b0e27e072be4 Alexander Duyck 2008-09-12 134 c1b52739e45f596 Benjamin LaHaise 2013-01-14 135 static int tcf_skbedit_init(struct net *net, struct nlattr *nla, a85a970af265f15 WANG Cong 2016-07-25 136 struct nlattr *est, struct tc_action **a, abbb0d33632ce93 Vlad Buslov 2019-10-30 137 struct tcf_proto *tp, u32 act_flags, 789871bb2a03814 Vlad Buslov 2018-07-05 138 struct netlink_ext_ack *extack) ca9b0e27e072be4 Alexander Duyck 2008-09-12 139 { ddf97ccdd7cb7e0 WANG Cong 2016-02-22 140 struct tc_action_net *tn = net_generic(net, skbedit_net_id); 695176bfe5dec20 Cong Wang 2021-07-29 141 bool bind = act_flags & TCA_ACT_FLAGS_BIND; 6d7a8df6dfe4d62 Vlad Buslov 2018-09-03 142 struct tcf_skbedit_params *params_new; ca9b0e27e072be4 Alexander Duyck 2008-09-12 143 struct nlattr *tb[TCA_SKBEDIT_MAX + 1]; ec7727bb24b01e9 Davide Caratti 2019-03-20 144 struct tcf_chain *goto_ch = NULL; ca9b0e27e072be4 Alexander Duyck 2008-09-12 145 struct tc_skbedit *parm; ca9b0e27e072be4 Alexander Duyck 2008-09-12 146 struct tcf_skbedit *d; 4fe77d82ef80c77 Antonio Quartulli 2016-10-24 147 u32 flags = 0, *priority = NULL, *mark = NULL, *mask = NULL; ff202ee1ed8f032 Jamal Hadi Salim 2016-07-02 148 u16 *queue_mapping = NULL, *ptype = NULL; fca24c124e1091d Tonghao Zhang 2022-01-26 149 u16 mapping_mod = 1; b2313077ed0db35 WANG Cong 2016-06-13 150 bool exists = false; b2313077ed0db35 WANG Cong 2016-06-13 151 int ret = 0, err; 7be8ef2cdbfe41a Dmytro Linkin 2019-08-01 152 u32 index; ca9b0e27e072be4 Alexander Duyck 2008-09-12 153 ca9b0e27e072be4 Alexander Duyck 2008-09-12 154 if (nla == NULL) ca9b0e27e072be4 Alexander Duyck 2008-09-12 155 return -EINVAL; ca9b0e27e072be4 Alexander Duyck 2008-09-12 156 8cb081746c031fb Johannes Berg 2019-04-26 157 err = nla_parse_nested_deprecated(tb, TCA_SKBEDIT_MAX, nla, 8cb081746c031fb Johannes Berg 2019-04-26 158 skbedit_policy, NULL); ca9b0e27e072be4 Alexander Duyck 2008-09-12 159 if (err < 0) ca9b0e27e072be4 Alexander Duyck 2008-09-12 160 return err; ca9b0e27e072be4 Alexander Duyck 2008-09-12 161 ca9b0e27e072be4 Alexander Duyck 2008-09-12 162 if (tb[TCA_SKBEDIT_PARMS] == NULL) ca9b0e27e072be4 Alexander Duyck 2008-09-12 163 return -EINVAL; ca9b0e27e072be4 Alexander Duyck 2008-09-12 164 ca9b0e27e072be4 Alexander Duyck 2008-09-12 165 if (tb[TCA_SKBEDIT_PRIORITY] != NULL) { ca9b0e27e072be4 Alexander Duyck 2008-09-12 166 flags |= SKBEDIT_F_PRIORITY; ca9b0e27e072be4 Alexander Duyck 2008-09-12 167 priority = nla_data(tb[TCA_SKBEDIT_PRIORITY]); ca9b0e27e072be4 Alexander Duyck 2008-09-12 168 } ca9b0e27e072be4 Alexander Duyck 2008-09-12 169 ca9b0e27e072be4 Alexander Duyck 2008-09-12 170 if (tb[TCA_SKBEDIT_QUEUE_MAPPING] != NULL) { ca9b0e27e072be4 Alexander Duyck 2008-09-12 171 flags |= SKBEDIT_F_QUEUE_MAPPING; ca9b0e27e072be4 Alexander Duyck 2008-09-12 172 queue_mapping = nla_data(tb[TCA_SKBEDIT_QUEUE_MAPPING]); ca9b0e27e072be4 Alexander Duyck 2008-09-12 173 } 1c55d62e77fa16c jamal 2009-10-15 174 ff202ee1ed8f032 Jamal Hadi Salim 2016-07-02 175 if (tb[TCA_SKBEDIT_PTYPE] != NULL) { ff202ee1ed8f032 Jamal Hadi Salim 2016-07-02 176 ptype = nla_data(tb[TCA_SKBEDIT_PTYPE]); ff202ee1ed8f032 Jamal Hadi Salim 2016-07-02 177 if (!skb_pkt_type_ok(*ptype)) ff202ee1ed8f032 Jamal Hadi Salim 2016-07-02 178 return -EINVAL; ff202ee1ed8f032 Jamal Hadi Salim 2016-07-02 179 flags |= SKBEDIT_F_PTYPE; ff202ee1ed8f032 Jamal Hadi Salim 2016-07-02 180 } ff202ee1ed8f032 Jamal Hadi Salim 2016-07-02 181 1c55d62e77fa16c jamal 2009-10-15 182 if (tb[TCA_SKBEDIT_MARK] != NULL) { 1c55d62e77fa16c jamal 2009-10-15 183 flags |= SKBEDIT_F_MARK; 1c55d62e77fa16c jamal 2009-10-15 184 mark = nla_data(tb[TCA_SKBEDIT_MARK]); 1c55d62e77fa16c jamal 2009-10-15 185 } 1c55d62e77fa16c jamal 2009-10-15 186 4fe77d82ef80c77 Antonio Quartulli 2016-10-24 187 if (tb[TCA_SKBEDIT_MASK] != NULL) { 4fe77d82ef80c77 Antonio Quartulli 2016-10-24 188 flags |= SKBEDIT_F_MASK; 4fe77d82ef80c77 Antonio Quartulli 2016-10-24 189 mask = nla_data(tb[TCA_SKBEDIT_MASK]); 4fe77d82ef80c77 Antonio Quartulli 2016-10-24 190 } 4fe77d82ef80c77 Antonio Quartulli 2016-10-24 191 e7e3728bd776d1d Qiaobin Fu 2018-07-01 192 if (tb[TCA_SKBEDIT_FLAGS] != NULL) { e7e3728bd776d1d Qiaobin Fu 2018-07-01 193 u64 *pure_flags = nla_data(tb[TCA_SKBEDIT_FLAGS]); fca24c124e1091d Tonghao Zhang 2022-01-26 194 u64 mapping_hash_type; e7e3728bd776d1d Qiaobin Fu 2018-07-01 195 fca24c124e1091d Tonghao Zhang 2022-01-26 196 mapping_hash_type = *pure_flags & SKBEDIT_F_TXQ_HASH_MASK; fca24c124e1091d Tonghao Zhang 2022-01-26 197 if (mapping_hash_type) { fca24c124e1091d Tonghao Zhang 2022-01-26 198 u16 *queue_mapping_max; fca24c124e1091d Tonghao Zhang 2022-01-26 199 fca24c124e1091d Tonghao Zhang 2022-01-26 200 /* Hash types are mutually exclusive. */ fca24c124e1091d Tonghao Zhang 2022-01-26 201 if (mapping_hash_type & (mapping_hash_type - 1)) { fca24c124e1091d Tonghao Zhang 2022-01-26 202 NL_SET_ERR_MSG_MOD(extack, "Multi types of hash are specified."); fca24c124e1091d Tonghao Zhang 2022-01-26 203 return -EINVAL; fca24c124e1091d Tonghao Zhang 2022-01-26 204 } fca24c124e1091d Tonghao Zhang 2022-01-26 205 fca24c124e1091d Tonghao Zhang 2022-01-26 206 if (!tb[TCA_SKBEDIT_QUEUE_MAPPING] || fca24c124e1091d Tonghao Zhang 2022-01-26 207 !tb[TCA_SKBEDIT_QUEUE_MAPPING_MAX]) { fca24c124e1091d Tonghao Zhang 2022-01-26 208 NL_SET_ERR_MSG_MOD(extack, "Missing required range of queue_mapping."); fca24c124e1091d Tonghao Zhang 2022-01-26 209 return -EINVAL; fca24c124e1091d Tonghao Zhang 2022-01-26 210 } fca24c124e1091d Tonghao Zhang 2022-01-26 211 fca24c124e1091d Tonghao Zhang 2022-01-26 212 queue_mapping_max = fca24c124e1091d Tonghao Zhang 2022-01-26 213 nla_data(tb[TCA_SKBEDIT_QUEUE_MAPPING_MAX]); fca24c124e1091d Tonghao Zhang 2022-01-26 214 if (*queue_mapping_max < *queue_mapping) { fca24c124e1091d Tonghao Zhang 2022-01-26 215 NL_SET_ERR_MSG_MOD(extack, "The range of queue_mapping is invalid, max < min."); fca24c124e1091d Tonghao Zhang 2022-01-26 216 return -EINVAL; fca24c124e1091d Tonghao Zhang 2022-01-26 217 } fca24c124e1091d Tonghao Zhang 2022-01-26 218 fca24c124e1091d Tonghao Zhang 2022-01-26 219 mapping_mod = *queue_mapping_max - *queue_mapping + 1; fca24c124e1091d Tonghao Zhang 2022-01-26 220 flags |= mapping_hash_type; fca24c124e1091d Tonghao Zhang 2022-01-26 221 } e7e3728bd776d1d Qiaobin Fu 2018-07-01 222 if (*pure_flags & SKBEDIT_F_INHERITDSFIELD) e7e3728bd776d1d Qiaobin Fu 2018-07-01 223 flags |= SKBEDIT_F_INHERITDSFIELD; e7e3728bd776d1d Qiaobin Fu 2018-07-01 224 } e7e3728bd776d1d Qiaobin Fu 2018-07-01 225 ca9b0e27e072be4 Alexander Duyck 2008-09-12 226 parm = nla_data(tb[TCA_SKBEDIT_PARMS]); 7be8ef2cdbfe41a Dmytro Linkin 2019-08-01 227 index = parm->index; 7be8ef2cdbfe41a Dmytro Linkin 2019-08-01 228 err = tcf_idr_check_alloc(tn, &index, a, bind); 0190c1d452a91c3 Vlad Buslov 2018-07-05 229 if (err < 0) 0190c1d452a91c3 Vlad Buslov 2018-07-05 230 return err; 0190c1d452a91c3 Vlad Buslov 2018-07-05 231 exists = err; 5e1567aeb7fe0ca Jamal Hadi Salim 2016-05-10 232 if (exists && bind) 5e1567aeb7fe0ca Jamal Hadi Salim 2016-05-10 233 return 0; 5e1567aeb7fe0ca Jamal Hadi Salim 2016-05-10 234 5e1567aeb7fe0ca Jamal Hadi Salim 2016-05-10 235 if (!flags) { af5d01842fe1fbf Roman Mashak 2018-05-11 236 if (exists) 65a206c01e8e7ff Chris Mi 2017-08-30 237 tcf_idr_release(*a, bind); 0190c1d452a91c3 Vlad Buslov 2018-07-05 238 else 7be8ef2cdbfe41a Dmytro Linkin 2019-08-01 239 tcf_idr_cleanup(tn, index); 5e1567aeb7fe0ca Jamal Hadi Salim 2016-05-10 240 return -EINVAL; 5e1567aeb7fe0ca Jamal Hadi Salim 2016-05-10 241 } 5e1567aeb7fe0ca Jamal Hadi Salim 2016-05-10 242 5e1567aeb7fe0ca Jamal Hadi Salim 2016-05-10 243 if (!exists) { 7be8ef2cdbfe41a Dmytro Linkin 2019-08-01 244 ret = tcf_idr_create(tn, index, est, a, 40bd094d65fc9f8 Baowen Zheng 2021-12-17 245 &act_skbedit_ops, bind, true, act_flags); 0190c1d452a91c3 Vlad Buslov 2018-07-05 246 if (ret) { 7be8ef2cdbfe41a Dmytro Linkin 2019-08-01 247 tcf_idr_cleanup(tn, index); 86062033feb8a16 WANG Cong 2014-02-11 248 return ret; 0190c1d452a91c3 Vlad Buslov 2018-07-05 249 } ca9b0e27e072be4 Alexander Duyck 2008-09-12 250 a85a970af265f15 WANG Cong 2016-07-25 251 d = to_skbedit(*a); ca9b0e27e072be4 Alexander Duyck 2008-09-12 252 ret = ACT_P_CREATED; ca9b0e27e072be4 Alexander Duyck 2008-09-12 253 } else { a85a970af265f15 WANG Cong 2016-07-25 254 d = to_skbedit(*a); 695176bfe5dec20 Cong Wang 2021-07-29 255 if (!(act_flags & TCA_ACT_FLAGS_REPLACE)) { 65a206c01e8e7ff Chris Mi 2017-08-30 256 tcf_idr_release(*a, bind); ca9b0e27e072be4 Alexander Duyck 2008-09-12 257 return -EEXIST; ca9b0e27e072be4 Alexander Duyck 2008-09-12 258 } 4e8ddd7f1758ca4 Vlad Buslov 2018-07-05 259 } ec7727bb24b01e9 Davide Caratti 2019-03-20 260 err = tcf_action_check_ctrlact(parm->action, tp, &goto_ch, extack); ec7727bb24b01e9 Davide Caratti 2019-03-20 261 if (err < 0) ec7727bb24b01e9 Davide Caratti 2019-03-20 262 goto release_idr; ca9b0e27e072be4 Alexander Duyck 2008-09-12 263 c749cdda9089eb1 Davide Caratti 2018-07-11 264 params_new = kzalloc(sizeof(*params_new), GFP_KERNEL); c749cdda9089eb1 Davide Caratti 2018-07-11 265 if (unlikely(!params_new)) { ec7727bb24b01e9 Davide Caratti 2019-03-20 266 err = -ENOMEM; ec7727bb24b01e9 Davide Caratti 2019-03-20 267 goto put_chain; c749cdda9089eb1 Davide Caratti 2018-07-11 268 } ca9b0e27e072be4 Alexander Duyck 2008-09-12 269 c749cdda9089eb1 Davide Caratti 2018-07-11 270 params_new->flags = flags; ca9b0e27e072be4 Alexander Duyck 2008-09-12 271 if (flags & SKBEDIT_F_PRIORITY) c749cdda9089eb1 Davide Caratti 2018-07-11 @272 params_new->priority = *priority; fca24c124e1091d Tonghao Zhang 2022-01-26 273 if (flags & SKBEDIT_F_QUEUE_MAPPING) { c749cdda9089eb1 Davide Caratti 2018-07-11 274 params_new->queue_mapping = *queue_mapping; fca24c124e1091d Tonghao Zhang 2022-01-26 275 params_new->mapping_mod = mapping_mod; fca24c124e1091d Tonghao Zhang 2022-01-26 276 } 1c55d62e77fa16c jamal 2009-10-15 277 if (flags & SKBEDIT_F_MARK) c749cdda9089eb1 Davide Caratti 2018-07-11 @278 params_new->mark = *mark; ff202ee1ed8f032 Jamal Hadi Salim 2016-07-02 279 if (flags & SKBEDIT_F_PTYPE) c749cdda9089eb1 Davide Caratti 2018-07-11 @280 params_new->ptype = *ptype; 4fe77d82ef80c77 Antonio Quartulli 2016-10-24 281 /* default behaviour is to use all the bits */ c749cdda9089eb1 Davide Caratti 2018-07-11 282 params_new->mask = 0xffffffff; 4fe77d82ef80c77 Antonio Quartulli 2016-10-24 283 if (flags & SKBEDIT_F_MASK) c749cdda9089eb1 Davide Caratti 2018-07-11 @284 params_new->mask = *mask; 1c55d62e77fa16c jamal 2009-10-15 285 6d7a8df6dfe4d62 Vlad Buslov 2018-09-03 286 spin_lock_bh(&d->tcf_lock); ec7727bb24b01e9 Davide Caratti 2019-03-20 287 goto_ch = tcf_action_set_ctrlact(*a, parm->action, goto_ch); 445d3749315f342 Paul E. McKenney 2019-09-23 288 params_new = rcu_replace_pointer(d->params, params_new, 6d7a8df6dfe4d62 Vlad Buslov 2018-09-03 289 lockdep_is_held(&d->tcf_lock)); 6d7a8df6dfe4d62 Vlad Buslov 2018-09-03 290 spin_unlock_bh(&d->tcf_lock); 6d7a8df6dfe4d62 Vlad Buslov 2018-09-03 291 if (params_new) 6d7a8df6dfe4d62 Vlad Buslov 2018-09-03 292 kfree_rcu(params_new, rcu); ec7727bb24b01e9 Davide Caratti 2019-03-20 293 if (goto_ch) ec7727bb24b01e9 Davide Caratti 2019-03-20 294 tcf_chain_put_by_act(goto_ch); ca9b0e27e072be4 Alexander Duyck 2008-09-12 295 ca9b0e27e072be4 Alexander Duyck 2008-09-12 296 return ret; ec7727bb24b01e9 Davide Caratti 2019-03-20 297 put_chain: ec7727bb24b01e9 Davide Caratti 2019-03-20 298 if (goto_ch) ec7727bb24b01e9 Davide Caratti 2019-03-20 299 tcf_chain_put_by_act(goto_ch); ec7727bb24b01e9 Davide Caratti 2019-03-20 300 release_idr: ec7727bb24b01e9 Davide Caratti 2019-03-20 301 tcf_idr_release(*a, bind); ec7727bb24b01e9 Davide Caratti 2019-03-20 302 return err; ca9b0e27e072be4 Alexander Duyck 2008-09-12 303 } ca9b0e27e072be4 Alexander Duyck 2008-09-12 304 --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/[email protected] _______________________________________________ kbuild mailing list -- [email protected] To unsubscribe send an email to [email protected]
