[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAM0EoMnnXNxtzDqtC96rbKjy1qfebtBTPpGj7MR7j4uzqXjEWA@mail.gmail.com>
Date: Wed, 6 Dec 2023 10:08:22 -0500
From: Jamal Hadi Salim <jhs@...atatu.com>
To: Dan Carpenter <dan.carpenter@...aro.org>
Cc: oe-kbuild@...ts.linux.dev, netdev@...r.kernel.org, lkp@...el.com,
oe-kbuild-all@...ts.linux.dev, deb.chatterjee@...el.com,
anjali.singhai@...el.com, namrata.limaye@...el.com, mleitner@...hat.com,
Mahesh.Shirshyad@....com, tomasz.osinski@...el.com, jiri@...nulli.us,
xiyou.wangcong@...il.com, davem@...emloft.net, edumazet@...gle.com,
kuba@...nel.org, pabeni@...hat.com, vladbu@...dia.com, horms@...nel.org,
khalidm@...dia.com, toke@...hat.com, daniel@...earbox.net,
bpf@...r.kernel.org
Subject: Re: [PATCH net-next v9 13/15] p4tc: add runtime table entry create,
update, get, delete, flush and dump
Hi Dan,
On Wed, Dec 6, 2023 at 12:34 AM Dan Carpenter <dan.carpenter@...aro.org> 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
> 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 <lkp@...el.com>
> | Reported-by: Dan Carpenter <dan.carpenter@...aro.org>
> | Closes: https://lore.kernel.org/r/202312052121.NV57fCuG-lkp@intel.com/
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
>
Powered by blists - more mailing lists