Hi Kumar, Thank you for the patch! Perhaps something to improve: [auto build test WARNING on bpf-next/master] url: https://github.com/0day-ci/linux/commits/Kumar-Kartikeya-Dwivedi/Add-bpf_link-based-TC-BPF-API/20210604-143611 base: https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git master config: i386-randconfig-s001-20210603 (attached as .config) compiler: gcc-9 (Debian 9.3.0-22) 9.3.0 reproduce: # apt-get install sparse # sparse version: v0.6.3-341-g8af24329-dirty # https://github.com/0day-ci/linux/commit/a8da2c7297ab4c27511723367a5679b51bd5af7c git remote add linux-review https://github.com/0day-ci/linux git fetch --no-tags linux-review Kumar-Kartikeya-Dwivedi/Add-bpf_link-based-TC-BPF-API/20210604-143611 git checkout a8da2c7297ab4c27511723367a5679b51bd5af7c # save the attached .config to linux build tree make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' W=1 ARCH=i386 If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot <lkp@xxxxxxxxx> sparse warnings: (new ones prefixed by >>) net/sched/cls_api.c:270:22: sparse: sparse: incorrect type in assignment (different base types) @@ expected restricted __be16 [usertype] protocol @@ got unsigned int [usertype] protocol @@ net/sched/cls_api.c:270:22: sparse: expected restricted __be16 [usertype] protocol net/sched/cls_api.c:270:22: sparse: got unsigned int [usertype] protocol net/sched/cls_api.c:1675:16: sparse: sparse: incompatible types in comparison expression (different address spaces): net/sched/cls_api.c:1675:16: sparse: struct tcf_proto * net/sched/cls_api.c:1675:16: sparse: struct tcf_proto [noderef] __rcu * net/sched/cls_api.c:1776:20: sparse: sparse: incompatible types in comparison expression (different address spaces): net/sched/cls_api.c:1776:20: sparse: struct tcf_proto [noderef] __rcu * net/sched/cls_api.c:1776:20: sparse: struct tcf_proto * net/sched/cls_api.c:1737:25: sparse: sparse: incompatible types in comparison expression (different address spaces): net/sched/cls_api.c:1737:25: sparse: struct tcf_proto [noderef] __rcu * net/sched/cls_api.c:1737:25: sparse: struct tcf_proto * net/sched/cls_api.c:1757:16: sparse: sparse: incompatible types in comparison expression (different address spaces): net/sched/cls_api.c:1757:16: sparse: struct tcf_proto * net/sched/cls_api.c:1757:16: sparse: struct tcf_proto [noderef] __rcu * net/sched/cls_api.c:1823:25: sparse: sparse: restricted __be16 degrades to integer net/sched/cls_api.c:2497:50: sparse: sparse: restricted __be16 degrades to integer >> net/sched/cls_api.c:3976:52: sparse: sparse: incorrect type in argument 3 (different base types) @@ expected unsigned int [usertype] protocol @@ got restricted __be16 [assigned] [usertype] protocol @@ net/sched/cls_api.c:3976:52: sparse: expected unsigned int [usertype] protocol net/sched/cls_api.c:3976:52: sparse: got restricted __be16 [assigned] [usertype] protocol net/sched/cls_api.c:3998:50: sparse: sparse: incorrect type in argument 2 (different base types) @@ expected unsigned int [usertype] protocol @@ got restricted __be16 [assigned] [usertype] protocol @@ net/sched/cls_api.c:3998:50: sparse: expected unsigned int [usertype] protocol net/sched/cls_api.c:3998:50: sparse: got restricted __be16 [assigned] [usertype] protocol net/sched/cls_api.c:4006:64: sparse: sparse: incorrect type in argument 3 (different base types) @@ expected unsigned int [usertype] protocol @@ got restricted __be16 [assigned] [usertype] protocol @@ net/sched/cls_api.c:4006:64: sparse: expected unsigned int [usertype] protocol net/sched/cls_api.c:4006:64: sparse: got restricted __be16 [assigned] [usertype] protocol vim +3976 net/sched/cls_api.c 3924 3925 int bpf_tc_link_attach(union bpf_attr *attr, struct bpf_prog *prog) 3926 { 3927 struct net *net = current->nsproxy->net_ns; 3928 struct tcf_chain_info chain_info; 3929 u32 chain_index, prio, parent; 3930 struct tcf_block *block; 3931 struct tcf_chain *chain; 3932 struct tcf_proto *tp; 3933 int err, tp_created; 3934 unsigned long cl; 3935 struct Qdisc *q; 3936 __be16 protocol; 3937 void *fh; 3938 3939 /* Caller already checks bpf_capable */ 3940 if (!ns_capable(current->nsproxy->net_ns->user_ns, CAP_NET_ADMIN)) 3941 return -EPERM; 3942 3943 if (attr->link_create.flags || 3944 !attr->link_create.target_ifindex || 3945 !tc_flags_valid(attr->link_create.tc.gen_flags)) 3946 return -EINVAL; 3947 3948 replay: 3949 parent = attr->link_create.tc.parent; 3950 prio = attr->link_create.tc.priority; 3951 protocol = htons(ETH_P_ALL); 3952 chain_index = 0; 3953 tp_created = 0; 3954 prio <<= 16; 3955 cl = 0; 3956 3957 /* Address this when cls_bpf switches to RTNL_FLAG_DOIT_UNLOCKED */ 3958 rtnl_lock(); 3959 3960 block = tcf_block_find(net, &q, &parent, &cl, 3961 attr->link_create.target_ifindex, parent, NULL); 3962 if (IS_ERR(block)) { 3963 err = PTR_ERR(block); 3964 goto out_unlock; 3965 } 3966 block->classid = parent; 3967 3968 chain = tcf_chain_get(block, chain_index, true); 3969 if (!chain) { 3970 err = -ENOMEM; 3971 goto out_block; 3972 } 3973 3974 mutex_lock(&chain->filter_chain_lock); 3975 > 3976 tp = tcf_chain_tp_find(chain, &chain_info, protocol, 3977 prio ?: TC_H_MAKE(0x80000000U, 0U), 3978 !prio); 3979 if (IS_ERR(tp)) { 3980 err = PTR_ERR(tp); 3981 goto out_chain_unlock; 3982 } 3983 3984 if (!tp) { 3985 struct tcf_proto *tp_new = NULL; 3986 3987 if (chain->flushing) { 3988 err = -EAGAIN; 3989 goto out_chain_unlock; 3990 } 3991 3992 if (!prio) 3993 prio = tcf_auto_prio(tcf_chain_tp_prev(chain, 3994 &chain_info)); 3995 3996 mutex_unlock(&chain->filter_chain_lock); 3997 3998 tp_new = tcf_proto_create("bpf", protocol, prio, chain, true, 3999 NULL); 4000 if (IS_ERR(tp_new)) { 4001 err = PTR_ERR(tp_new); 4002 goto out_chain; 4003 } 4004 4005 tp_created = 1; 4006 tp = tcf_chain_tp_insert_unique(chain, tp_new, protocol, prio, 4007 true); 4008 if (IS_ERR(tp)) { 4009 err = PTR_ERR(tp); 4010 goto out_chain; 4011 } 4012 } else { 4013 mutex_unlock(&chain->filter_chain_lock); 4014 } 4015 4016 fh = tp->ops->get(tp, attr->link_create.tc.handle); 4017 4018 if (!tp->ops->bpf_link_change) 4019 err = -EDEADLK; 4020 else 4021 err = tp->ops->bpf_link_change(net, tp, prog, &fh, 4022 attr->link_create.tc.handle, 4023 attr->link_create.tc.gen_flags); 4024 if (err >= 0 && q) 4025 q->flags &= ~TCQ_F_CAN_BYPASS; 4026 4027 out: 4028 if (err < 0 && tp_created) 4029 tcf_chain_tp_delete_empty(chain, tp, true, NULL); 4030 out_chain: 4031 if (chain) { 4032 if (!IS_ERR_OR_NULL(tp)) 4033 tcf_proto_put(tp, true, NULL); 4034 /* Chain reference only kept for tp creation 4035 * to pair with tcf_chain_put from tcf_proto_destroy 4036 */ 4037 if (!tp_created) 4038 tcf_chain_put(chain); 4039 } 4040 out_block: 4041 tcf_block_release(q, block, true); 4042 out_unlock: 4043 rtnl_unlock(); 4044 if (err == -EAGAIN) 4045 goto replay; 4046 return err; 4047 out_chain_unlock: 4048 mutex_unlock(&chain->filter_chain_lock); 4049 goto out; 4050 } 4051 --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx
Attachment:
.config.gz
Description: application/gzip