DPDK patches and discussions
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: "Medvedkin, Vladimir" <vladimir.medvedkin@intel.com>
Cc: Andre Muezerie <andremue@linux.microsoft.com>,
	Bruce Richardson <bruce.richardson@intel.com>, <dev@dpdk.org>
Subject: Re: [PATCH] app/test: fix stack overflow in lpm6_perf_autotest
Date: Fri, 13 Dec 2024 09:08:22 -0800	[thread overview]
Message-ID: <20241213090822.23687f7a@hermes.local> (raw)
In-Reply-To: <aac21b6c-c0ee-4cb1-8d88-1880592c9085@intel.com>

On Fri, 13 Dec 2024 10:22:20 +0000
"Medvedkin, Vladimir" <vladimir.medvedkin@intel.com> wrote:

> Hi Andre,
> 
> On 13/12/2024 02:39, Andre Muezerie wrote:
> > Test lpm6_perf_autotest was hitting a stack overflow on Windows
> > with both MSVC and Clang.
> >
> > The fix is to move some of the data from the stack to the heap.
> >
> > Signed-off-by: Andre Muezerie <andremue@linux.microsoft.com>
> > ---
> >   app/test/test_lpm6_perf.c | 11 +++++++++--
> >   1 file changed, 9 insertions(+), 2 deletions(-)
> >
> > diff --git a/app/test/test_lpm6_perf.c b/app/test/test_lpm6_perf.c
> > index 1860a99ed6..8231ad825d 100644
> > --- a/app/test/test_lpm6_perf.c
> > +++ b/app/test/test_lpm6_perf.c
> > @@ -117,8 +117,12 @@ test_lpm6_perf(void)
> >   	total_time = 0;
> >   	count = 0;
> >   
> > -	struct rte_ipv6_addr ip_batch[NUM_IPS_ENTRIES];
> > -	int32_t next_hops[NUM_IPS_ENTRIES];
> > +	struct rte_ipv6_addr *ip_batch = (struct rte_ipv6_addr *)malloc(  
> why not rte_malloc?
> > +			sizeof(struct rte_ipv6_addr) * NUM_IPS_ENTRIES);
> > +	TEST_LPM_ASSERT(ip_batch != NULL);

There is no need for rte_malloc() here. The data doesn't need to
come from hugepages and regular malloc() has more checking.

But the cast is unnecessary in C.

  parent reply	other threads:[~2024-12-13 17:08 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-13  2:39 Andre Muezerie
2024-12-13 10:22 ` Medvedkin, Vladimir
2024-12-13 17:05   ` Andre Muezerie
2024-12-13 17:08   ` Stephen Hemminger [this message]
2024-12-13 17:08 ` [PATCH v2] " Andre Muezerie
2024-12-13 17:15   ` Stephen Hemminger
2024-12-18 15:12     ` Andre Muezerie
2024-12-18 15:21 ` [PATCH v3] " Andre Muezerie

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=20241213090822.23687f7a@hermes.local \
    --to=stephen@networkplumber.org \
    --cc=andremue@linux.microsoft.com \
    --cc=bruce.richardson@intel.com \
    --cc=dev@dpdk.org \
    --cc=vladimir.medvedkin@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).