Skip to content

Commit cdfa60a

Browse files
author
Alexei Starovoitov
committed
Merge branch 'bpf-next/master' into for-next
Signed-off-by: Alexei Starovoitov <[email protected]>
2 parents 909ea6e + f66b4aa commit cdfa60a

File tree

5 files changed

+317
-74
lines changed

5 files changed

+317
-74
lines changed

kernel/bpf/btf.c

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3443,7 +3443,8 @@ btf_find_graph_root(const struct btf *btf, const struct btf_type *pt,
34433443
node_field_name = strstr(value_type, ":");
34443444
if (!node_field_name)
34453445
return -EINVAL;
3446-
value_type = kstrndup(value_type, node_field_name - value_type, GFP_KERNEL | __GFP_NOWARN);
3446+
value_type = kstrndup(value_type, node_field_name - value_type,
3447+
GFP_KERNEL_ACCOUNT | __GFP_NOWARN);
34473448
if (!value_type)
34483449
return -ENOMEM;
34493450
id = btf_find_by_name_kind(btf, value_type, BTF_KIND_STRUCT);
@@ -3958,7 +3959,7 @@ struct btf_record *btf_parse_fields(const struct btf *btf, const struct btf_type
39583959
/* This needs to be kzalloc to zero out padding and unused fields, see
39593960
* comment in btf_record_equal.
39603961
*/
3961-
rec = kzalloc(struct_size(rec, fields, cnt), GFP_KERNEL | __GFP_NOWARN);
3962+
rec = kzalloc(struct_size(rec, fields, cnt), GFP_KERNEL_ACCOUNT | __GFP_NOWARN);
39623963
if (!rec)
39633964
return ERR_PTR(-ENOMEM);
39643965

@@ -9019,15 +9020,15 @@ static struct bpf_cand_cache *populate_cand_cache(struct bpf_cand_cache *cands,
90199020
bpf_free_cands_from_cache(*cc);
90209021
*cc = NULL;
90219022
}
9022-
new_cands = kmemdup(cands, sizeof_cands(cands->cnt), GFP_KERNEL);
9023+
new_cands = kmemdup(cands, sizeof_cands(cands->cnt), GFP_KERNEL_ACCOUNT);
90239024
if (!new_cands) {
90249025
bpf_free_cands(cands);
90259026
return ERR_PTR(-ENOMEM);
90269027
}
90279028
/* strdup the name, since it will stay in cache.
90289029
* the cands->name points to strings in prog's BTF and the prog can be unloaded.
90299030
*/
9030-
new_cands->name = kmemdup_nul(cands->name, cands->name_len, GFP_KERNEL);
9031+
new_cands->name = kmemdup_nul(cands->name, cands->name_len, GFP_KERNEL_ACCOUNT);
90319032
bpf_free_cands(cands);
90329033
if (!new_cands->name) {
90339034
kfree(new_cands);
@@ -9111,7 +9112,7 @@ bpf_core_add_cands(struct bpf_cand_cache *cands, const struct btf *targ_btf,
91119112
continue;
91129113

91139114
/* most of the time there is only one candidate for a given kind+name pair */
9114-
new_cands = kmalloc(sizeof_cands(cands->cnt + 1), GFP_KERNEL);
9115+
new_cands = kmalloc(sizeof_cands(cands->cnt + 1), GFP_KERNEL_ACCOUNT);
91159116
if (!new_cands) {
91169117
bpf_free_cands(cands);
91179118
return ERR_PTR(-ENOMEM);
@@ -9228,7 +9229,7 @@ int bpf_core_apply(struct bpf_core_ctx *ctx, const struct bpf_core_relo *relo,
92289229
/* ~4k of temp memory necessary to convert LLVM spec like "0:1:0:5"
92299230
* into arrays of btf_ids of struct fields and array indices.
92309231
*/
9231-
specs = kcalloc(3, sizeof(*specs), GFP_KERNEL);
9232+
specs = kcalloc(3, sizeof(*specs), GFP_KERNEL_ACCOUNT);
92329233
if (!specs)
92339234
return -ENOMEM;
92349235

@@ -9253,7 +9254,7 @@ int bpf_core_apply(struct bpf_core_ctx *ctx, const struct bpf_core_relo *relo,
92539254
goto out;
92549255
}
92559256
if (cc->cnt) {
9256-
cands.cands = kcalloc(cc->cnt, sizeof(*cands.cands), GFP_KERNEL);
9257+
cands.cands = kcalloc(cc->cnt, sizeof(*cands.cands), GFP_KERNEL_ACCOUNT);
92579258
if (!cands.cands) {
92589259
err = -ENOMEM;
92599260
goto out;

0 commit comments

Comments
 (0)