All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Cong Wang <xiyou.wangcong@gmail.com>
Cc: llvm@lists.linux.dev, kbuild-all@lists.01.org,
	linux-kernel@vger.kernel.org
Subject: [congwang:sch_bpf 2/3] net/sched/sch_bpf.c:185:21: error: called object type 'int' is not a function or function pointer
Date: Sun, 5 Sep 2021 07:02:48 +0800	[thread overview]
Message-ID: <202109050734.TFcRP0kk-lkp@intel.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 7290 bytes --]

tree:   https://github.com/congwang/linux.git sch_bpf
head:   f680855badd6d78b73490b5785ed3de5d68bf26b
commit: ac00415a225e3cbd2c3a7fd5f38dacdfadfcc1ac [2/3] net_sched: introduce eBPF based Qdisc
config: hexagon-buildonly-randconfig-r004-20210905 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 6fe2beba7d2a41964af658c8c59dd172683ef739)
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/congwang/linux/commit/ac00415a225e3cbd2c3a7fd5f38dacdfadfcc1ac
        git remote add congwang https://github.com/congwang/linux.git
        git fetch --no-tags congwang sch_bpf
        git checkout ac00415a225e3cbd2c3a7fd5f38dacdfadfcc1ac
        # save the attached .config to linux build tree
        mkdir build_dir
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross O=build_dir ARCH=hexagon SHELL=/bin/bash net/sched/

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All error/warnings (new ones prefixed by >>):

>> net/sched/sch_bpf.c:144:6: warning: variable 'cl' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
           if (result  >= 0) {
               ^~~~~~~~~~~~
   net/sched/sch_bpf.c:164:9: note: uninitialized use occurs here
           return cl;
                  ^~
   net/sched/sch_bpf.c:144:2: note: remove the 'if' if its condition is always true
           if (result  >= 0) {
           ^~~~~~~~~~~~~~~~~~
   net/sched/sch_bpf.c:134:26: note: initialize the variable 'cl' to silence this warning
           struct sch_bpf_class *cl;
                                   ^
                                    = NULL
>> net/sched/sch_bpf.c:185:21: error: called object type 'int' is not a function or function pointer
                   res = BPF_PROG_RUN(enqueue, &ctx);
                         ~~~~~~~~~~~~^
   net/sched/sch_bpf.c:254:20: error: called object type 'int' is not a function or function pointer
           res = BPF_PROG_RUN(dequeue, &ctx);
                 ~~~~~~~~~~~~^
>> net/sched/sch_bpf.c:256:10: error: incompatible pointer types returning 'struct __sk_buff *' from a function with result type 'struct sk_buff *' [-Werror,-Wincompatible-pointer-types]
                   return ctx.skb;
                          ^~~~~~~
   net/sched/sch_bpf.c:525:24: warning: unused variable 'q' [-Wunused-variable]
           struct sch_bpf_qdisc *q = qdisc_priv(sch);
                                 ^
   2 warnings and 3 errors generated.


vim +/int +185 net/sched/sch_bpf.c

   130	
   131	static struct sch_bpf_class *sch_bpf_classify(struct sk_buff *skb, struct Qdisc *sch, int *qerr)
   132	{
   133		struct sch_bpf_qdisc *q = qdisc_priv(sch);
   134		struct sch_bpf_class *cl;
   135		struct tcf_proto *tcf;
   136		struct tcf_result res;
   137		int result;
   138	
   139		tcf = rcu_dereference_bh(q->filter_list);
   140		if (!tcf)
   141			return NULL;
   142		*qerr = NET_XMIT_SUCCESS | __NET_XMIT_BYPASS;
   143		result = tcf_classify(skb, NULL, tcf, &res, false);
 > 144		if (result  >= 0) {
   145	#ifdef CONFIG_NET_CLS_ACT
   146			switch (result) {
   147			case TC_ACT_QUEUED:
   148			case TC_ACT_STOLEN:
   149			case TC_ACT_TRAP:
   150				*qerr = NET_XMIT_SUCCESS | __NET_XMIT_STOLEN;
   151				fallthrough;
   152			case TC_ACT_SHOT:
   153				return NULL;
   154			}
   155	#endif
   156			cl = (void *)res.class;
   157			if (!cl) {
   158				cl = sch_bpf_find(sch, res.classid);
   159				if (!cl)
   160					return NULL;
   161			}
   162		}
   163	
   164		return cl;
   165	}
   166	
   167	static int sch_bpf_enqueue(struct sk_buff *skb, struct Qdisc *sch,
   168				   struct sk_buff **to_free)
   169	{
   170		struct sch_bpf_qdisc *q = qdisc_priv(sch);
   171		unsigned int len = qdisc_pkt_len(skb);
   172		struct sch_bpf_ctx ctx = {};
   173		struct sch_bpf_class *cl;
   174		int res = NET_XMIT_SUCCESS;
   175	
   176		cl = sch_bpf_classify(skb, sch, &res);
   177		if (!cl) {
   178			struct bpf_prog *enqueue;
   179	
   180			enqueue = rcu_dereference(q->enqueue_prog.prog);
   181			bpf_compute_data_pointers(skb);
   182	
   183			ctx.skb = (struct __sk_buff *)skb;
   184			ctx.nr_flows = q->clhash.hashelems;
 > 185			res = BPF_PROG_RUN(enqueue, &ctx);
   186			if (q->direct)
   187				return res;
   188			switch (res) {
   189			case SCH_BPF_DROP:
   190				__qdisc_drop(skb, to_free);
   191				return NET_XMIT_DROP;
   192			}
   193			cl = sch_bpf_find(sch, ctx.classid);
   194			if (!cl) {
   195				if (res & __NET_XMIT_BYPASS)
   196					qdisc_qstats_drop(sch);
   197				__qdisc_drop(skb, to_free);
   198				return res;
   199			}
   200		}
   201	
   202		if (cl->qdisc) {
   203			res = qdisc_enqueue(skb, cl->qdisc, to_free);
   204			if (res != NET_XMIT_SUCCESS) {
   205				if (net_xmit_drop_count(res)) {
   206					qdisc_qstats_drop(sch);
   207					cl->drops++;
   208				}
   209				return res;
   210			}
   211		} else {
   212			sch_bpf_skb_cb(skb)->rank = ctx.rank;
   213			pq_push(&cl->pq, &skb->pqnode);
   214		}
   215	
   216		sch->qstats.backlog += len;
   217		sch->q.qlen++;
   218		return res;
   219	}
   220	
   221	static struct sk_buff *sch_bpf_dequeue(struct Qdisc *sch)
   222	{
   223		struct sch_bpf_qdisc *q = qdisc_priv(sch);
   224		struct sk_buff *skb, *ret = NULL;
   225		struct sch_bpf_ctx ctx = {};
   226		struct bpf_prog *dequeue;
   227		struct sch_bpf_class *cl;
   228		struct pq_node *flow;
   229		s64 now;
   230		int res;
   231	
   232	requeue:
   233		flow = pq_pop(&q->flows);
   234		if (!flow)
   235			return NULL;
   236	
   237		cl = container_of(flow, struct sch_bpf_class, node);
   238		if (cl->qdisc) {
   239			skb = cl->qdisc->dequeue(cl->qdisc);
   240			ctx.classid = cl->common.classid;
   241		} else {
   242			struct pq_node *p = pq_pop(&cl->pq);
   243	
   244			if (!p)
   245				return NULL;
   246			skb = container_of(p, struct sk_buff, pqnode);
   247			ctx.classid = cl->rank;
   248		}
   249		ctx.skb = (struct __sk_buff *) skb;
   250		ctx.nr_flows = q->clhash.hashelems;
   251	
   252		dequeue = rcu_dereference(q->dequeue_prog.prog);
   253		bpf_compute_data_pointers(skb);
   254		res = BPF_PROG_RUN(dequeue, &ctx);
   255		if (q->direct)
 > 256			return ctx.skb;
   257		switch (res) {
   258		case SCH_BPF_OK:
   259			ret = skb;
   260			break;
   261		case SCH_BPF_REQUEUE:
   262			sch_bpf_skb_cb(skb)->rank = ctx.rank;
   263			cl->rank = ctx.classid;
   264			pq_push(&cl->pq, &skb->pqnode);
   265			bstats_update(&cl->bstats, skb);
   266			pq_push(&q->flows, &cl->node);
   267			goto requeue;
   268		case SCH_BPF_THROTTLE:
   269			now = ktime_get_ns();
   270			qdisc_watchdog_schedule_ns(&q->watchdog, now + ctx.delay);
   271			qdisc_qstats_overlimit(sch);
   272			cl->overlimits++;
   273			return NULL;
   274		default:
   275			kfree_skb(skb);
   276			ret = NULL;
   277		}
   278	
   279		if (pq_top(&cl->pq))
   280			pq_push(&q->flows, &cl->node);
   281		return ret;
   282	}
   283	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 31953 bytes --]

WARNING: multiple messages have this Message-ID (diff)
From: kernel test robot <lkp@intel.com>
To: kbuild-all@lists.01.org
Subject: [congwang:sch_bpf 2/3] net/sched/sch_bpf.c:185:21: error: called object type 'int' is not a function or function pointer
Date: Sun, 05 Sep 2021 07:02:48 +0800	[thread overview]
Message-ID: <202109050734.TFcRP0kk-lkp@intel.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 7501 bytes --]

tree:   https://github.com/congwang/linux.git sch_bpf
head:   f680855badd6d78b73490b5785ed3de5d68bf26b
commit: ac00415a225e3cbd2c3a7fd5f38dacdfadfcc1ac [2/3] net_sched: introduce eBPF based Qdisc
config: hexagon-buildonly-randconfig-r004-20210905 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 6fe2beba7d2a41964af658c8c59dd172683ef739)
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/congwang/linux/commit/ac00415a225e3cbd2c3a7fd5f38dacdfadfcc1ac
        git remote add congwang https://github.com/congwang/linux.git
        git fetch --no-tags congwang sch_bpf
        git checkout ac00415a225e3cbd2c3a7fd5f38dacdfadfcc1ac
        # save the attached .config to linux build tree
        mkdir build_dir
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross O=build_dir ARCH=hexagon SHELL=/bin/bash net/sched/

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All error/warnings (new ones prefixed by >>):

>> net/sched/sch_bpf.c:144:6: warning: variable 'cl' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
           if (result  >= 0) {
               ^~~~~~~~~~~~
   net/sched/sch_bpf.c:164:9: note: uninitialized use occurs here
           return cl;
                  ^~
   net/sched/sch_bpf.c:144:2: note: remove the 'if' if its condition is always true
           if (result  >= 0) {
           ^~~~~~~~~~~~~~~~~~
   net/sched/sch_bpf.c:134:26: note: initialize the variable 'cl' to silence this warning
           struct sch_bpf_class *cl;
                                   ^
                                    = NULL
>> net/sched/sch_bpf.c:185:21: error: called object type 'int' is not a function or function pointer
                   res = BPF_PROG_RUN(enqueue, &ctx);
                         ~~~~~~~~~~~~^
   net/sched/sch_bpf.c:254:20: error: called object type 'int' is not a function or function pointer
           res = BPF_PROG_RUN(dequeue, &ctx);
                 ~~~~~~~~~~~~^
>> net/sched/sch_bpf.c:256:10: error: incompatible pointer types returning 'struct __sk_buff *' from a function with result type 'struct sk_buff *' [-Werror,-Wincompatible-pointer-types]
                   return ctx.skb;
                          ^~~~~~~
   net/sched/sch_bpf.c:525:24: warning: unused variable 'q' [-Wunused-variable]
           struct sch_bpf_qdisc *q = qdisc_priv(sch);
                                 ^
   2 warnings and 3 errors generated.


vim +/int +185 net/sched/sch_bpf.c

   130	
   131	static struct sch_bpf_class *sch_bpf_classify(struct sk_buff *skb, struct Qdisc *sch, int *qerr)
   132	{
   133		struct sch_bpf_qdisc *q = qdisc_priv(sch);
   134		struct sch_bpf_class *cl;
   135		struct tcf_proto *tcf;
   136		struct tcf_result res;
   137		int result;
   138	
   139		tcf = rcu_dereference_bh(q->filter_list);
   140		if (!tcf)
   141			return NULL;
   142		*qerr = NET_XMIT_SUCCESS | __NET_XMIT_BYPASS;
   143		result = tcf_classify(skb, NULL, tcf, &res, false);
 > 144		if (result  >= 0) {
   145	#ifdef CONFIG_NET_CLS_ACT
   146			switch (result) {
   147			case TC_ACT_QUEUED:
   148			case TC_ACT_STOLEN:
   149			case TC_ACT_TRAP:
   150				*qerr = NET_XMIT_SUCCESS | __NET_XMIT_STOLEN;
   151				fallthrough;
   152			case TC_ACT_SHOT:
   153				return NULL;
   154			}
   155	#endif
   156			cl = (void *)res.class;
   157			if (!cl) {
   158				cl = sch_bpf_find(sch, res.classid);
   159				if (!cl)
   160					return NULL;
   161			}
   162		}
   163	
   164		return cl;
   165	}
   166	
   167	static int sch_bpf_enqueue(struct sk_buff *skb, struct Qdisc *sch,
   168				   struct sk_buff **to_free)
   169	{
   170		struct sch_bpf_qdisc *q = qdisc_priv(sch);
   171		unsigned int len = qdisc_pkt_len(skb);
   172		struct sch_bpf_ctx ctx = {};
   173		struct sch_bpf_class *cl;
   174		int res = NET_XMIT_SUCCESS;
   175	
   176		cl = sch_bpf_classify(skb, sch, &res);
   177		if (!cl) {
   178			struct bpf_prog *enqueue;
   179	
   180			enqueue = rcu_dereference(q->enqueue_prog.prog);
   181			bpf_compute_data_pointers(skb);
   182	
   183			ctx.skb = (struct __sk_buff *)skb;
   184			ctx.nr_flows = q->clhash.hashelems;
 > 185			res = BPF_PROG_RUN(enqueue, &ctx);
   186			if (q->direct)
   187				return res;
   188			switch (res) {
   189			case SCH_BPF_DROP:
   190				__qdisc_drop(skb, to_free);
   191				return NET_XMIT_DROP;
   192			}
   193			cl = sch_bpf_find(sch, ctx.classid);
   194			if (!cl) {
   195				if (res & __NET_XMIT_BYPASS)
   196					qdisc_qstats_drop(sch);
   197				__qdisc_drop(skb, to_free);
   198				return res;
   199			}
   200		}
   201	
   202		if (cl->qdisc) {
   203			res = qdisc_enqueue(skb, cl->qdisc, to_free);
   204			if (res != NET_XMIT_SUCCESS) {
   205				if (net_xmit_drop_count(res)) {
   206					qdisc_qstats_drop(sch);
   207					cl->drops++;
   208				}
   209				return res;
   210			}
   211		} else {
   212			sch_bpf_skb_cb(skb)->rank = ctx.rank;
   213			pq_push(&cl->pq, &skb->pqnode);
   214		}
   215	
   216		sch->qstats.backlog += len;
   217		sch->q.qlen++;
   218		return res;
   219	}
   220	
   221	static struct sk_buff *sch_bpf_dequeue(struct Qdisc *sch)
   222	{
   223		struct sch_bpf_qdisc *q = qdisc_priv(sch);
   224		struct sk_buff *skb, *ret = NULL;
   225		struct sch_bpf_ctx ctx = {};
   226		struct bpf_prog *dequeue;
   227		struct sch_bpf_class *cl;
   228		struct pq_node *flow;
   229		s64 now;
   230		int res;
   231	
   232	requeue:
   233		flow = pq_pop(&q->flows);
   234		if (!flow)
   235			return NULL;
   236	
   237		cl = container_of(flow, struct sch_bpf_class, node);
   238		if (cl->qdisc) {
   239			skb = cl->qdisc->dequeue(cl->qdisc);
   240			ctx.classid = cl->common.classid;
   241		} else {
   242			struct pq_node *p = pq_pop(&cl->pq);
   243	
   244			if (!p)
   245				return NULL;
   246			skb = container_of(p, struct sk_buff, pqnode);
   247			ctx.classid = cl->rank;
   248		}
   249		ctx.skb = (struct __sk_buff *) skb;
   250		ctx.nr_flows = q->clhash.hashelems;
   251	
   252		dequeue = rcu_dereference(q->dequeue_prog.prog);
   253		bpf_compute_data_pointers(skb);
   254		res = BPF_PROG_RUN(dequeue, &ctx);
   255		if (q->direct)
 > 256			return ctx.skb;
   257		switch (res) {
   258		case SCH_BPF_OK:
   259			ret = skb;
   260			break;
   261		case SCH_BPF_REQUEUE:
   262			sch_bpf_skb_cb(skb)->rank = ctx.rank;
   263			cl->rank = ctx.classid;
   264			pq_push(&cl->pq, &skb->pqnode);
   265			bstats_update(&cl->bstats, skb);
   266			pq_push(&q->flows, &cl->node);
   267			goto requeue;
   268		case SCH_BPF_THROTTLE:
   269			now = ktime_get_ns();
   270			qdisc_watchdog_schedule_ns(&q->watchdog, now + ctx.delay);
   271			qdisc_qstats_overlimit(sch);
   272			cl->overlimits++;
   273			return NULL;
   274		default:
   275			kfree_skb(skb);
   276			ret = NULL;
   277		}
   278	
   279		if (pq_top(&cl->pq))
   280			pq_push(&q->flows, &cl->node);
   281		return ret;
   282	}
   283	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 31953 bytes --]

             reply	other threads:[~2021-09-04 23:03 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-04 23:02 kernel test robot [this message]
2021-09-04 23:02 ` [congwang:sch_bpf 2/3] net/sched/sch_bpf.c:185:21: error: called object type 'int' is not a function or function pointer kernel test robot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202109050734.TFcRP0kk-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=kbuild-all@lists.01.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=llvm@lists.linux.dev \
    --cc=xiyou.wangcong@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.