Skip to content

Commit

Permalink
test: check memory allocation for CRC
Browse files Browse the repository at this point in the history
[ upstream commit 52aab95 ]

The rte_zmalloc is called in test_crc_calc without null pointer
check. This patch adds null pointer checks on return value of
rte_zmalloc.

Fixes: 9c77b84 ("test: add CRC computation")

Signed-off-by: Hongbo Zheng <zhenghongbo3@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
  • Loading branch information
Hongbo Zheng authored and steevenlee committed Jul 19, 2022
1 parent ef31c19 commit 4fef76f
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions app/test/test_crc.c
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ test_crc_calc(void)

/* 32-bit ethernet CRC: Test 2 */
test_data = rte_zmalloc(NULL, CRC32_VEC_LEN1, 0);
if (test_data == NULL)
return -7;

for (i = 0; i < CRC32_VEC_LEN1; i += 12)
rte_memcpy(&test_data[i], crc32_vec1, 12);
Expand Down

0 comments on commit 4fef76f

Please sign in to comment.