Re: [PATCH net-next v9 13/15] p4tc: add runtime table entry create, update, get, delete, flush and dump

From
Jamal Hadi Salim <jhs@mojatatu.com>
Date
2023-12-06 15:08:34
Also in
bpf, oe-kbuild, oe-kbuild-all
Reply to
Dan Carpenter, 2023-12-06
Hi Dan,

On Wed, Dec 6, 2023 at 12:34 AM Dan Carpenter [off-list ref] wrote:
Hi Jamal,

kernel test robot noticed the following build warnings:

url:    https://github.com/intel-lab-lkp/linux/commits/Jamal-Hadi-Salim/net-sched-act_api-increase-action-kind-string-length/20231202-032940
base:   net-next/main
patch link:    https://lore.kernel.org/r/20231201182904.532825-14-jhs%40mojatatu.com (local)
patch subject: [PATCH net-next v9 13/15] p4tc: add runtime table entry create, update, get, delete, flush and dump
config: powerpc64-randconfig-r081-20231204 (https://download.01.org/0day-ci/archive/20231205/202312052121.NV57fCuG-lkp@intel.com/config)
compiler: powerpc64-linux-gcc (GCC) 13.2.0
reproduce: (https://download.01.org/0day-ci/archive/20231205/202312052121.NV57fCuG-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot [off-list ref]
| Reported-by: Dan Carpenter [off-list ref]
| Closes: https://lore.kernel.org/r/202312052121.NV57fCuG-lkp@intel.com/ (local)
Thanks - Will do (it will be a new version not separate fix commit).
smatch warnings:
net/sched/p4tc/p4tc_tbl_entry.c:2555 p4tc_tbl_entry_dumpit() warn: can 'nl_path_attrs.pname' even be NULL?
We need to update our smatch i suppose because we didnt catch this one.

cheers,
jamal
vim +2555 net/sched/p4tc/p4tc_tbl_entry.c

0d5bbed1381e54 Jamal Hadi Salim 2023-12-01  2529        pnatt = nla_reserve(skb, P4TC_ROOT_PNAME, P4TC_PIPELINE_NAMSIZ);
0d5bbed1381e54 Jamal Hadi Salim 2023-12-01  2530        if (!pnatt)
0d5bbed1381e54 Jamal Hadi Salim 2023-12-01  2531                return -ENOMEM;
0d5bbed1381e54 Jamal Hadi Salim 2023-12-01  2532
0d5bbed1381e54 Jamal Hadi Salim 2023-12-01  2533        ids[P4TC_PID_IDX] = t_new->pipeid;
0d5bbed1381e54 Jamal Hadi Salim 2023-12-01  2534        arg_ids = nla_data(tb[P4TC_PATH]);
0d5bbed1381e54 Jamal Hadi Salim 2023-12-01  2535        memcpy(&ids[P4TC_TBLID_IDX], arg_ids, nla_len(tb[P4TC_PATH]));
0d5bbed1381e54 Jamal Hadi Salim 2023-12-01  2536        nl_path_attrs.ids = ids;
0d5bbed1381e54 Jamal Hadi Salim 2023-12-01  2537
0d5bbed1381e54 Jamal Hadi Salim 2023-12-01  2538        nl_path_attrs.pname = nla_data(pnatt);

nla_data() can't be NULL

0d5bbed1381e54 Jamal Hadi Salim 2023-12-01  2539        if (!p_name) {
0d5bbed1381e54 Jamal Hadi Salim 2023-12-01  2540                /* Filled up by the operation or forced failure */
0d5bbed1381e54 Jamal Hadi Salim 2023-12-01  2541                memset(nl_path_attrs.pname, 0, P4TC_PIPELINE_NAMSIZ);
0d5bbed1381e54 Jamal Hadi Salim 2023-12-01  2542                nl_path_attrs.pname_passed = false;
0d5bbed1381e54 Jamal Hadi Salim 2023-12-01  2543        } else {
0d5bbed1381e54 Jamal Hadi Salim 2023-12-01  2544                strscpy(nl_path_attrs.pname, p_name, P4TC_PIPELINE_NAMSIZ);

And we dereference it

0d5bbed1381e54 Jamal Hadi Salim 2023-12-01  2545                nl_path_attrs.pname_passed = true;
0d5bbed1381e54 Jamal Hadi Salim 2023-12-01  2546        }
0d5bbed1381e54 Jamal Hadi Salim 2023-12-01  2547
0d5bbed1381e54 Jamal Hadi Salim 2023-12-01  2548        root = nla_nest_start(skb, P4TC_ROOT);
0d5bbed1381e54 Jamal Hadi Salim 2023-12-01  2549        ret = p4tc_table_entry_dump(net, skb, tb[P4TC_PARAMS], &nl_path_attrs,
0d5bbed1381e54 Jamal Hadi Salim 2023-12-01  2550                                    cb, extack);
0d5bbed1381e54 Jamal Hadi Salim 2023-12-01  2551        if (ret <= 0)
0d5bbed1381e54 Jamal Hadi Salim 2023-12-01  2552                goto out;
0d5bbed1381e54 Jamal Hadi Salim 2023-12-01  2553        nla_nest_end(skb, root);
0d5bbed1381e54 Jamal Hadi Salim 2023-12-01  2554
0d5bbed1381e54 Jamal Hadi Salim 2023-12-01 @2555        if (nl_path_attrs.pname) {
                                                            ^^^^^^^^^^^^^^^^^^^
This NULL check can be removed.


--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
Thread (30 messages) 30 messages, 6 authors, last reply 2023-12-11
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help