[bug report] samples/bpf: bpf_tail_call example for networking

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello Alexei Starovoitov,

Commit 530b2c8619f2 ("samples/bpf: bpf_tail_call example for
networking") from May 19, 2015 (linux-next), leads to the following
Smatch static checker warning:

	samples/bpf/sockex3_kern.c:240 bpf_func_mpls()
	warn: masked condition '(verlen & 240) == 4' is always false.

./samples/bpf/sockex3_kern.c
    227 SEC("socket")
    228 int bpf_func_mpls(struct __sk_buff *skb)
    229 {
    230         __u32 nhoff, label;
    231 
    232         nhoff = skb->cb[0];
    233 
    234         label = load_word(skb, nhoff);
    235         nhoff += sizeof(struct mpls_label);
    236         skb->cb[0] = nhoff;
    237 
    238         if (label & MPLS_LS_S_MASK) {
    239                 __u8 verlen = load_byte(skb, nhoff);
--> 240                 if ((verlen & 0xF0) == 4)
                            ^^^^^^^^^^^^^^^^^^^^
This can't be true.  Was it supposed to be 0x0F or 0x40?

    241                         parse_eth_proto(skb, ETH_P_IP);
    242                 else
    243                         parse_eth_proto(skb, ETH_P_IPV6);
    244         } else {
    245                 parse_eth_proto(skb, ETH_P_MPLS_UC);
    246         }
    247 
    248         return 0;
    249 }

regards,
dan carpenter




[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux