diff options
author | David S. Miller <davem@davemloft.net> | 2020-06-17 13:26:55 -0700 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2020-06-17 13:26:55 -0700 |
commit | b9d37bbb55b8993d296a86fa21f98fa550b61967 (patch) | |
tree | 73a93a246e9261c7738595af15e6f5a0cf44115a /samples/bpf/xdp_monitor_user.c | |
parent | Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net (diff) | |
parent | bpf: Document optval > PAGE_SIZE behavior for sockopt hooks (diff) | |
download | wireguard-linux-b9d37bbb55b8993d296a86fa21f98fa550b61967.tar.xz wireguard-linux-b9d37bbb55b8993d296a86fa21f98fa550b61967.zip |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf
Alexei Starovoitov says:
====================
pull-request: bpf 2020-06-17
The following pull-request contains BPF updates for your *net* tree.
We've added 10 non-merge commits during the last 2 day(s) which contain
a total of 14 files changed, 158 insertions(+), 59 deletions(-).
The main changes are:
1) Important fix for bpf_probe_read_kernel_str() return value, from Andrii.
2) [gs]etsockopt fix for large optlen, from Stanislav.
3) devmap allocation fix, from Toke.
====================
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'samples/bpf/xdp_monitor_user.c')
-rw-r--r-- | samples/bpf/xdp_monitor_user.c | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/samples/bpf/xdp_monitor_user.c b/samples/bpf/xdp_monitor_user.c index dd558cbb2309..ef53b93db573 100644 --- a/samples/bpf/xdp_monitor_user.c +++ b/samples/bpf/xdp_monitor_user.c @@ -509,11 +509,8 @@ static void *alloc_rec_per_cpu(int record_size) { unsigned int nr_cpus = bpf_num_possible_cpus(); void *array; - size_t size; - size = record_size * nr_cpus; - array = malloc(size); - memset(array, 0, size); + array = calloc(nr_cpus, record_size); if (!array) { fprintf(stderr, "Mem alloc error (nr_cpus:%u)\n", nr_cpus); exit(EXIT_FAIL_MEM); @@ -528,8 +525,7 @@ static struct stats_record *alloc_stats_record(void) int i; /* Alloc main stats_record structure */ - rec = malloc(sizeof(*rec)); - memset(rec, 0, sizeof(*rec)); + rec = calloc(1, sizeof(*rec)); if (!rec) { fprintf(stderr, "Mem alloc error\n"); exit(EXIT_FAIL_MEM); |