@@ -3443,7 +3443,8 @@ btf_find_graph_root(const struct btf *btf, const struct btf_type *pt,
3443
3443
node_field_name = strstr (value_type , ":" );
3444
3444
if (!node_field_name )
3445
3445
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 );
3447
3448
if (!value_type )
3448
3449
return - ENOMEM ;
3449
3450
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
3958
3959
/* This needs to be kzalloc to zero out padding and unused fields, see
3959
3960
* comment in btf_record_equal.
3960
3961
*/
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 );
3962
3963
if (!rec )
3963
3964
return ERR_PTR (- ENOMEM );
3964
3965
@@ -9019,15 +9020,15 @@ static struct bpf_cand_cache *populate_cand_cache(struct bpf_cand_cache *cands,
9019
9020
bpf_free_cands_from_cache (* cc );
9020
9021
* cc = NULL ;
9021
9022
}
9022
- new_cands = kmemdup (cands , sizeof_cands (cands -> cnt ), GFP_KERNEL );
9023
+ new_cands = kmemdup (cands , sizeof_cands (cands -> cnt ), GFP_KERNEL_ACCOUNT );
9023
9024
if (!new_cands ) {
9024
9025
bpf_free_cands (cands );
9025
9026
return ERR_PTR (- ENOMEM );
9026
9027
}
9027
9028
/* strdup the name, since it will stay in cache.
9028
9029
* the cands->name points to strings in prog's BTF and the prog can be unloaded.
9029
9030
*/
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 );
9031
9032
bpf_free_cands (cands );
9032
9033
if (!new_cands -> name ) {
9033
9034
kfree (new_cands );
@@ -9111,7 +9112,7 @@ bpf_core_add_cands(struct bpf_cand_cache *cands, const struct btf *targ_btf,
9111
9112
continue ;
9112
9113
9113
9114
/* 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 );
9115
9116
if (!new_cands ) {
9116
9117
bpf_free_cands (cands );
9117
9118
return ERR_PTR (- ENOMEM );
@@ -9228,7 +9229,7 @@ int bpf_core_apply(struct bpf_core_ctx *ctx, const struct bpf_core_relo *relo,
9228
9229
/* ~4k of temp memory necessary to convert LLVM spec like "0:1:0:5"
9229
9230
* into arrays of btf_ids of struct fields and array indices.
9230
9231
*/
9231
- specs = kcalloc (3 , sizeof (* specs ), GFP_KERNEL );
9232
+ specs = kcalloc (3 , sizeof (* specs ), GFP_KERNEL_ACCOUNT );
9232
9233
if (!specs )
9233
9234
return - ENOMEM ;
9234
9235
@@ -9253,7 +9254,7 @@ int bpf_core_apply(struct bpf_core_ctx *ctx, const struct bpf_core_relo *relo,
9253
9254
goto out ;
9254
9255
}
9255
9256
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 );
9257
9258
if (!cands .cands ) {
9258
9259
err = - ENOMEM ;
9259
9260
goto out ;
0 commit comments