diff mbox series

[3/3] kni: fix unchecked return value

Message ID 1619063789-60922-4-git-send-email-humin29@huawei.com (mailing list archive)
State Accepted
Delegated to: Ferruh Yigit
Headers show
Series bugfix for kni | expand

Checks

Context Check Description
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-abi-testing success Testing PASS
ci/iol-testing success Testing PASS
ci/intel-Testing success Testing PASS
ci/github-robot success github build: passed
ci/Intel-compilation success Compilation OK
ci/checkpatch success coding style OK

Commit Message

Min Hu (Connor) April 22, 2021, 3:56 a.m. UTC
Return value 'rte_kni_init' of a function is not checked. If
it fails, error handling (logging and return) should be done.

This patch fixed it.

Fixes: 0c6bc8ef70ba ("kni: memzone pool for alloc and release")
Cc: stable@dpdk.org

Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
---
 app/test/test_kni.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

Comments

Ferruh Yigit April 26, 2021, 1:35 p.m. UTC | #1
On 4/22/2021 4:56 AM, Min Hu (Connor) wrote:
> Return value 'rte_kni_init' of a function is not checked. If
> it fails, error handling (logging and return) should be done.
> 
> This patch fixed it.
> 
> Fixes: 0c6bc8ef70ba ("kni: memzone pool for alloc and release")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Min Hu (Connor) <humin29@huawei.com>

With the patch title update,

Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
diff mbox series

Patch

diff --git a/app/test/test_kni.c b/app/test/test_kni.c
index 3470005..9673355 100644
--- a/app/test/test_kni.c
+++ b/app/test/test_kni.c
@@ -563,7 +563,11 @@  test_kni(void)
 	closedir(dir);
 
 	/* Initialize KNI subsystem */
-	rte_kni_init(KNI_TEST_MAX_PORTS);
+	ret = rte_kni_init(KNI_TEST_MAX_PORTS);
+	if (ret < 0) {
+		printf("fail to initialize KNI subsystem\n");
+		return -1;
+	}
 
 	if (test_kni_allocate_lcores() < 0) {
 		printf("No enough lcores for kni processing\n");