diff options
| author | David S. Miller <[email protected]> | 2019-06-18 02:48:13 +0000 |
|---|---|---|
| committer | David S. Miller <[email protected]> | 2019-06-18 03:20:36 +0000 |
| commit | 13091aa30535b719e269f20a7bc34002bf5afae5 (patch) | |
| tree | bd17956c3ce606a119fadbd43bfa1c0c10006984 /net/core/bpf_sk_storage.c | |
| parent | Merge branch 'UDP-GSO-audit-tests' (diff) | |
| parent | Merge branch 'fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs (diff) | |
| download | kernel-13091aa30535b719e269f20a7bc34002bf5afae5.tar.gz kernel-13091aa30535b719e269f20a7bc34002bf5afae5.zip | |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Honestly all the conflicts were simple overlapping changes,
nothing really interesting to report.
Signed-off-by: David S. Miller <[email protected]>
Diffstat (limited to 'net/core/bpf_sk_storage.c')
| -rw-r--r-- | net/core/bpf_sk_storage.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/net/core/bpf_sk_storage.c b/net/core/bpf_sk_storage.c index f40e3d35fd9c..94c7f77ecb6b 100644 --- a/net/core/bpf_sk_storage.c +++ b/net/core/bpf_sk_storage.c @@ -634,7 +634,8 @@ static struct bpf_map *bpf_sk_storage_map_alloc(union bpf_attr *attr) return ERR_PTR(-ENOMEM); bpf_map_init_from_attr(&smap->map, attr); - smap->bucket_log = ilog2(roundup_pow_of_two(num_possible_cpus())); + /* Use at least 2 buckets, select_bucket() is undefined behavior with 1 bucket */ + smap->bucket_log = max_t(u32, 1, ilog2(roundup_pow_of_two(num_possible_cpus()))); nbuckets = 1U << smap->bucket_log; cost = sizeof(*smap->buckets) * nbuckets + sizeof(*smap); |
