]> asedeno.scripts.mit.edu Git - linux.git/blobdiff - kernel/bpf/lpm_trie.c
Merge tag 'gvt-fixes-2020-02-26' of https://github.com/intel/gvt-linux into drm-intel...
[linux.git] / kernel / bpf / lpm_trie.c
index 57b59cca4db77a27cd497731d175d338ba59aac2..56e6c75d354d9027622f78fe5de5d2e4bb982640 100644 (file)
@@ -570,14 +570,8 @@ static struct bpf_map *trie_alloc(union bpf_attr *attr)
        cost_per_node = sizeof(struct lpm_trie_node) +
                        attr->value_size + trie->data_size;
        cost += (u64) attr->max_entries * cost_per_node;
-       if (cost >= U32_MAX - PAGE_SIZE) {
-               ret = -E2BIG;
-               goto out_err;
-       }
-
-       trie->map.pages = round_up(cost, PAGE_SIZE) >> PAGE_SHIFT;
 
-       ret = bpf_map_precharge_memlock(trie->map.pages);
+       ret = bpf_map_charge_init(&trie->map.memory, cost);
        if (ret)
                goto out_err;