[dpdk-dev] app/test: Fix potential null pointer accesses in test_mbuf

Message ID 1434077640-23957-1-git-send-email-mukawa@igel.co.jp (mailing list archive)
State Accepted, archived
Headers

Commit Message

Tetsuya Mukawa June 12, 2015, 2:54 a.m. UTC
  The patch fixes potential null pointer accesses in test_mbuf.
if 'm[i]' is null, stop accessing it.

Signed-off-by: Tetsuya Mukawa <mukawa@igel.co.jp>
---
 app/test/test_mbuf.c | 2 ++
 1 file changed, 2 insertions(+)
  

Comments

Thomas Monjalon June 22, 2015, 9:07 p.m. UTC | #1
2015-06-12 11:54, Tetsuya Mukawa:
> The patch fixes potential null pointer accesses in test_mbuf.
> if 'm[i]' is null, stop accessing it.
> 
> Signed-off-by: Tetsuya Mukawa <mukawa@igel.co.jp>

Applied, thanks
  

Patch

diff --git a/app/test/test_mbuf.c b/app/test/test_mbuf.c
index 5e8a377..5d13b37 100644
--- a/app/test/test_mbuf.c
+++ b/app/test/test_mbuf.c
@@ -594,6 +594,7 @@  test_pktmbuf_pool_ptr(void)
 		if (m[i] == NULL) {
 			printf("rte_pktmbuf_alloc() failed (%u)\n", i);
 			ret = -1;
+			break;
 		}
 		m[i]->data_off += 64;
 	}
@@ -613,6 +614,7 @@  test_pktmbuf_pool_ptr(void)
 		if (m[i] == NULL) {
 			printf("rte_pktmbuf_alloc() failed (%u)\n", i);
 			ret = -1;
+			break;
 		}
 		if (m[i]->data_off != RTE_PKTMBUF_HEADROOM) {
 			printf("invalid data_off\n");