Re: [PATCH bpf-next v10 1/1] bpf, docs: document BPF_MAP_TYPE_ARRAY

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

 



Andrii Nakryiko <andrii.nakryiko@xxxxxxxxx> writes:

> On Wed, Nov 9, 2022 at 9:46 AM Donald Hunter <donald.hunter@xxxxxxxxx> wrote:
>>
>> +This example BPF program shows how to access an array element.
>> +
>> +.. code-block:: c
>> +
>> +    int bpf_prog(struct __sk_buff *skb)
>> +    {
>> +            struct iphdr ip;
>> +            int index;
>> +            long *value;
>> +
>> +            if (bpf_skb_load_bytes(skb, ETH_HLEN, &ip, sizeof(ip)) < 0)
>> +                    return 0;
>> +
>> +            index = ip.protocol;
>> +            value = bpf_map_lookup_elem(&my_map, &index);
>> +            if (value)
>> +                    __sync_fetch_and_add(value, skb->len);
>
> should be &value
>
> I fixed it up and applied to bpf-next, thanks.

I double checked and it really should be value, which is already a
pointer.

Do you want me to send a patch to fix it up?



[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux