DPDK patches and discussions
 help / color / mirror / Atom feed
From: Tetsuya Mukawa <mukawa@igel.co.jp>
To: dev@dpdk.org
Subject: [dpdk-dev] [PATCH] app/test: Fix potential null pointer accesses in test_mbuf
Date: Fri, 12 Jun 2015 11:54:00 +0900	[thread overview]
Message-ID: <1434077640-23957-1-git-send-email-mukawa@igel.co.jp> (raw)

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(+)

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");
-- 
2.1.4

             reply	other threads:[~2015-06-12  2:54 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-12  2:54 Tetsuya Mukawa [this message]
2015-06-22 21:07 ` Thomas Monjalon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1434077640-23957-1-git-send-email-mukawa@igel.co.jp \
    --to=mukawa@igel.co.jp \
    --cc=dev@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).