DPDK patches and discussions
 help / color / mirror / Atom feed
From: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
To: Andre Muezerie <andremue@linux.microsoft.com>
Cc: honnappa.nagarahalli@arm.com, dev@dpdk.org
Subject: Re: Segfault in rcu
Date: Sat, 1 Mar 2025 22:35:48 +0300	[thread overview]
Message-ID: <CAEYuUWCgT8DUyHvUdnDo1r1YisU2JYfctRCNaq=kFusXPe_nQg@mail.gmail.com> (raw)
In-Reply-To: <20250301022622.GA6940@linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net>

Hi Andre,

> @@ -386,7 +386,7 @@ rte_rcu_qsbr_dq_reclaim(struct rte_rcu_qsbr_dq *dq, unsigned int n,
>
>      cnt = 0;
>
> -    char data[dq->esize];
> +    char *data = alloca(dq->esize);
>      /* Check reader threads quiescent state and reclaim resources */
>      while (cnt < n &&
>          rte_ring_dequeue_bulk_elem_start(dq->r, &data,

In the last line, "&data" was equivalent to "data" when "data" was an array.
This is no longer true when "data" is a pointer.
Removing "&" fixes the issue.
Maybe coccinelle can check for similar mistakes caused by mechanical
replacement of VLA to alloca()?

      reply	other threads:[~2025-03-01 19:36 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-01  2:26 Andre Muezerie
2025-03-01 19:35 ` Dmitry Kozlyuk [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='CAEYuUWCgT8DUyHvUdnDo1r1YisU2JYfctRCNaq=kFusXPe_nQg@mail.gmail.com' \
    --to=dmitry.kozliuk@gmail.com \
    --cc=andremue@linux.microsoft.com \
    --cc=dev@dpdk.org \
    --cc=honnappa.nagarahalli@arm.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).