intel / intel-ipsec-mb

Intel(R) Multi-Buffer Crypto for IPSec
BSD 3-Clause "New" or "Revised" License
288 stars 87 forks source link

Suggestion: maybe memset'ing job_template in do_test in /perf/ipsec_perf.c is a good idea #56

Closed ColinIanKing closed 4 years ago

ColinIanKing commented 4 years ago

Static analysis is producing some potential false positives on the job_template structure because it is allocated on the stack and all the fields are not being initialized. Some of the test paths cause static analysis to complain about fields not being initialized.

For example:


1477        for (i = 0; i < num_iter; i++) {
1478                job = IMB_GET_NEXT_JOB(mb_mgr);

    CID 99584 (#2-1 of 2): Uninitialized scalar variable (UNINIT)
23. uninit_use: Using uninitialized value job_template. Field job_template.src is uninitialized.

1479                *job = job_template;

and

2266                                        continue;
    CID 99592 (#1 of 1): Uninitialized scalar variable (UNINIT)
70. uninit_use_in_call: Using uninitialized value params. Field params.aes_key_size is uninitialized when calling run_dir_test. [show details]

2267                                run_dir_test(p_mgr, arch, &params, run,
2268                                             &variant_ptr, &variant, buf,
2269                                             keys, info->print_info);
pablodelara commented 4 years ago

Thanks for reporting this, @ColinIanKing. Will fix it shortly!