-
Notifications
You must be signed in to change notification settings - Fork 71
Commit 61f3298
committed
Fix Coverity
A function was being passed in the wrong length of a pointer.
Fixes:
```
test/acl_hal_test.cpp:362:3:
Type: Out-of-bounds access (OVERRUN)
test/acl_hal_test.cpp:303:3:
1. path: Condition "acl_set_hal(&simple_hal)", taking false branch.
test/acl_hal_test.cpp:303:3:
2. path: Condition "!Utest::getCurrent()->assertTrue(acl_set_hal(&simple_hal), "acl_set_hal(&simple_hal)", "/__w/fpga-runtime-for-opencl/fpga-runtime-for-opencl/test/acl_hal_test.cpp", 303)", taking true branch.
test/acl_hal_test.cpp:308:3:
3. path: Condition "acl_debug_env", taking true branch.
test/acl_hal_test.cpp:308:3:
4. path: Condition "!Utest::getCurrent()->assertTrue(acl_debug_env, "acl_debug_env", "/__w/fpga-runtime-for-opencl/fpga-runtime-for-opencl/test/acl_hal_test.cpp", 308)", taking true branch.
test/acl_hal_test.cpp:311:3:
5. path: Condition "0 != debug_mode", taking false branch.
test/acl_hal_test.cpp:313:3:
6. path: Condition "0 != acl_print_debug_msg("some text")", taking true branch.
test/acl_hal_test.cpp:313:3:
7. path: Falling through to end of if statement.
test/acl_hal_test.cpp:314:3:
8. path: Condition "0 != acl_print_debug_msg("")", taking true branch.
test/acl_hal_test.cpp:314:3:
9. path: Falling through to end of if statement.
test/acl_hal_test.cpp:319:3:
10. path: Condition "acl_debug_env", taking true branch.
test/acl_hal_test.cpp:319:3:
11. path: Condition "!Utest::getCurrent()->assertTrue(acl_debug_env, "acl_debug_env", "/__w/fpga-runtime-for-opencl/fpga-runtime-for-opencl/test/acl_hal_test.cpp", 319)", taking true branch.
test/acl_hal_test.cpp:321:3:
12. path: Condition "4 != debug_mode", taking true branch.
test/acl_hal_test.cpp:321:3:
13. path: Falling through to end of if statement.
test/acl_hal_test.cpp:324:3:
14. path: Condition "acl_debug_env", taking true branch.
test/acl_hal_test.cpp:324:3:
15. path: Condition "!Utest::getCurrent()->assertTrue(acl_debug_env, "acl_debug_env", "/__w/fpga-runtime-for-opencl/fpga-runtime-for-opencl/test/acl_hal_test.cpp", 324)", taking true branch.
test/acl_hal_test.cpp:326:3:
16. path: Condition "3 != debug_mode", taking true branch.
test/acl_hal_test.cpp:326:3:
17. path: Falling through to end of if statement.
test/acl_hal_test.cpp:329:3:
18. path: Condition "acl_debug_env", taking true branch.
test/acl_hal_test.cpp:329:3:
19. path: Condition "!Utest::getCurrent()->assertTrue(acl_debug_env, "acl_debug_env", "/__w/fpga-runtime-for-opencl/fpga-runtime-for-opencl/test/acl_hal_test.cpp", 329)", taking true branch.
test/acl_hal_test.cpp:331:3:
20. path: Condition "2 != debug_mode", taking true branch.
test/acl_hal_test.cpp:331:3:
21. path: Falling through to end of if statement.
test/acl_hal_test.cpp:332:3:
22. path: Condition "22UL /* sizeof (test_str) / sizeof (test_str[0]) - 1 */ != acl_print_debug_msg(test_str)", taking true branch.
test/acl_hal_test.cpp:332:3:
23. path: Falling through to end of if statement.
test/acl_hal_test.cpp:336:3:
24. path: Condition "0 != acl_print_debug_msg("")", taking true branch.
test/acl_hal_test.cpp:336:3:
25. path: Falling through to end of if statement.
test/acl_hal_test.cpp:339:3:
26. path: Condition "acl_debug_env", taking true branch.
test/acl_hal_test.cpp:339:3:
27. path: Condition "!Utest::getCurrent()->assertTrue(acl_debug_env, "acl_debug_env", "/__w/fpga-runtime-for-opencl/fpga-runtime-for-opencl/test/acl_hal_test.cpp", 339)", taking true branch.
test/acl_hal_test.cpp:341:3:
28. path: Condition "0 != debug_mode", taking false branch.
test/acl_hal_test.cpp:342:3:
29. path: Condition "0 != acl_print_debug_msg(test_str)", taking true branch.
test/acl_hal_test.cpp:342:3:
30. path: Falling through to end of if statement.
test/acl_hal_test.cpp:346:3:
31. path: Condition "1 != hal->query_temperature(0, &temp)", taking false branch.
test/acl_hal_test.cpp:347:3:
32. path: Condition "0 != temp", taking false branch.
test/acl_hal_test.cpp:353:3:
33. path: Condition "size_returned < 1024", taking true branch.
test/acl_hal_test.cpp:353:3:
34. path: Condition "!Utest::getCurrent()->assertTrue(size_returned < 1024, "size_returned < BUF_SIZE", "/__w/fpga-runtime-for-opencl/fpga-runtime-for-opencl/test/acl_hal_test.cpp", 353)", taking true branch.
test/acl_hal_test.cpp:354:3:
35. path: Condition "strcmp(name, "Test Device") == 0", taking true branch.
test/acl_hal_test.cpp:354:3:
36. path: Condition "!Utest::getCurrent()->assertTrue(strcmp(name, "Test Device") == 0, "strcmp(name, \"Test Device\") == 0", "/__w/fpga-runtime-for-opencl/fpga-runtime-for-opencl/test/acl_hal_test.cpp", 354)", taking true branch.
test/acl_hal_test.cpp:356:3:
37. path: Condition "size_returned < 1024", taking true branch.
test/acl_hal_test.cpp:356:3:
38. path: Condition "!Utest::getCurrent()->assertTrue(size_returned < 1024, "size_returned < BUF_SIZE", "/__w/fpga-runtime-for-opencl/fpga-runtime-for-opencl/test/acl_hal_test.cpp", 356)", taking true branch.
test/acl_hal_test.cpp:357:3:
39. path: Condition "strcmp(name, "Intel(R) Corporation") == 0", taking true branch.
test/acl_hal_test.cpp:357:3:
40. path: Condition "!Utest::getCurrent()->assertTrue(strcmp(name, "Intel(R) Corporation") == 0, "strcmp(name, \"Intel(R) Corporation\") == 0", "/__w/fpga-runtime-for-opencl/fpga-runtime-for-opencl/test/acl_hal_test.cpp", 357)", taking true branch.
test/acl_hal_test.cpp:362:3:
41. overrun-buffer-arg: Overrunning buffer pointed to by "&temp_u64" of 1 8-byte elements by passing it to a function which accesses it at element index 1 (byte offset 15) using argument "2U". (The function pointer resolves to "acl_hal_mmd_get_profile_data".)
src/acl_hal_mmd.cpp:2448:3:
41.1. path: Condition "physical_device_id < num_physical_devices", taking true branch.
src/acl_hal_mmd.cpp:2449:3:
41.2. access_dbuff_in_call: Calling "acl_kernel_if_get_profile_data" indexes array "data" with index "length".
src/acl_kernel_if.cpp:1870:3:
41.2.1. path: Condition "length > 0", taking true branch.
src/acl_kernel_if.cpp:1872:5:
41.2.2. path: Condition "kern->io.printf", taking true branch.
src/acl_kernel_if.cpp:1872:5:
41.2.3. path: Condition "kern->io.debug_verbosity > 0", taking true branch.
src/acl_kernel_if.cpp:1878:5:
41.2.4. path: Condition "i < length", taking true branch.
src/acl_kernel_if.cpp:1878:5:
41.2.5. loop_bounded_by_parm: "length" bounds loop condition "i < length".
src/acl_kernel_if.cpp:1879:7:
41.2.6. index_parm_via_loop_bound: Pointer "data" is accessed by "i", whose upper bound is "length" in loop conditional "i < length".
```OVERRUN
error for acl_hal_test.cpp
1 parent 2d33310 commit 61f3298Copy full SHA for 61f3298
File tree
Expand file treeCollapse file tree
1 file changed
+1
-1
lines changedFilter options
- test
Expand file treeCollapse file tree
1 file changed
+1
-1
lines changed+1-1Lines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
359 | 359 |
| |
360 | 360 |
| |
361 | 361 |
| |
362 |
| - | |
| 362 | + | |
363 | 363 |
| |
364 | 364 |
| |
365 | 365 |
| |
|
0 commit comments