DPDK patches and discussions
 help / color / mirror / Atom feed
From: Zhiheng Chen <chenzhiheng0227@gmail.com>
To: Konstantin Ananyev <konstantin.ananyev@intel.com>
Cc: dev@dpdk.org, Zhiheng Chen <chenzhiheng0227@gmail.com>
Subject: [PATCH] examples/l3fwd-acl:memset the acl matching result array
Date: Tue, 25 Jan 2022 07:29:15 +0000	[thread overview]
Message-ID: <20220125072915.17083-1-chenzhiheng0227@gmail.com> (raw)

If we don't memset acl result array before matching,
we can get arbitrary dirty data from memory.

Signed-off-by: Zhiheng Chen <chenzhiheng0227@gmail.com>
---
 examples/l3fwd-acl/main.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/examples/l3fwd-acl/main.c b/examples/l3fwd-acl/main.c
index 1fb1807235..7b9539b3ca 100644
--- a/examples/l3fwd-acl/main.c
+++ b/examples/l3fwd-acl/main.c
@@ -738,6 +738,9 @@ prepare_acl_parameter(struct rte_mbuf **pkts_in, struct acl_search_t *acl,
 	acl->num_ipv4 = 0;
 	acl->num_ipv6 = 0;
 
+	memset(acl->res_ipv4, 0, sizeof(acl->res_ipv4));
+	memset(acl->res_ipv6, 0, sizeof(acl->res_ipv6));
+
 	/* Prefetch first packets */
 	for (i = 0; i < PREFETCH_OFFSET && i < nb_rx; i++) {
 		rte_prefetch0(rte_pktmbuf_mtod(
-- 
2.32.0


             reply	other threads:[~2022-01-25  7:29 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-25  7:29 Zhiheng Chen [this message]
2022-01-25 14:02 ` Ananyev, Konstantin

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=20220125072915.17083-1-chenzhiheng0227@gmail.com \
    --to=chenzhiheng0227@gmail.com \
    --cc=dev@dpdk.org \
    --cc=konstantin.ananyev@intel.com \
    /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).