treewide: Use array_size() in vzalloc()
[linux-block.git] / kernel / bpf / verifier.c
index 1494e087890e73c07f678ea75c91e6e15506e84c..9e2bf834f13a21090b566862a853e7567ee03ac9 100644 (file)
@@ -5206,7 +5206,8 @@ static int adjust_insn_aux_data(struct bpf_verifier_env *env, u32 prog_len,
 
        if (cnt == 1)
                return 0;
-       new_data = vzalloc(sizeof(struct bpf_insn_aux_data) * prog_len);
+       new_data = vzalloc(array_size(prog_len,
+                                     sizeof(struct bpf_insn_aux_data)));
        if (!new_data)
                return -ENOMEM;
        memcpy(new_data, old_data, sizeof(struct bpf_insn_aux_data) * off);
@@ -5870,8 +5871,9 @@ int bpf_check(struct bpf_prog **prog, union bpf_attr *attr)
                return -ENOMEM;
        log = &env->log;
 
-       env->insn_aux_data = vzalloc(sizeof(struct bpf_insn_aux_data) *
-                                    (*prog)->len);
+       env->insn_aux_data =
+               vzalloc(array_size(sizeof(struct bpf_insn_aux_data),
+                                  (*prog)->len));
        ret = -ENOMEM;
        if (!env->insn_aux_data)
                goto err_free_env;