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



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

I don't think it is the case.
acl_classify() on successful completion will always populate result array.
The only exception - user provided ivalid input parameters, or acl ctx is not build, etc.
So no need to do memset() here.
 
> 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 14:05 UTC|newest]

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

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=DM6PR11MB449107BF899387F31C8D31FB9A5F9@DM6PR11MB4491.namprd11.prod.outlook.com \
    --to=konstantin.ananyev@intel.com \
    --cc=chenzhiheng0227@gmail.com \
    --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).