DPDK patches and discussions
 help / color / mirror / Atom feed
From: Thomas Monjalon <thomas@monjalon.net>
To: Ferruh Yigit <ferruh.yigit@intel.com>
Cc: Cristian Dumitrescu <cristian.dumitrescu@intel.com>,
	Pablo de Lara Guarch <pablo.de.lara.guarch@intel.com>,
	dev@dpdk.org, stable@dpdk.org,
	Kevin Traynor <ktraynor@redhat.com>
Subject: Re: [dpdk-dev] [PATCH] test/table: fix build with GCC 11
Date: Tue, 18 May 2021 10:55:44 +0200	[thread overview]
Message-ID: <16891120.zO6uBrY9Ry@thomas> (raw)
In-Reply-To: <20210517155739.800371-1-ferruh.yigit@intel.com>

17/05/2021 17:57, Ferruh Yigit:
> Build error:
> ../app/test/test_table_tables.c: In function ‘test_table_stub’:
> ../app/test/test_table_tables.c:31:9:
> 	warning: ‘memset’ offset [0, 31] is out of the bounds [0, 0]
> 	[-Warray-bounds]
>          memset((uint8_t *)mbuf + sizeof(struct rte_mbuf) + 32, 0, 32); \
>          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> ../app/test/test_table_tables.c:151:25:
> 	note: in expansion of macro ‘PREPARE_PACKET’
>   151 |                         PREPARE_PACKET(mbufs[i], 0xadadadad);
>       |                         ^~~~~~~~~~~~~~
> 
> 'key' points to mbuf header + 32 bytes, and memset clears next 32 bytes
> of 'key', so overall there needs to be 64 bytes after mbuf header.
> Adding a mbuf size check before memset.
> 
> The original code has an assumption that mbuf data buffer follows mbuf
> header, this patch accepts same assumption.
> 
> Bugzilla ID: 677
> Fixes: 5205954791cb ("app/test: packet framework unit tests")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
> ---
> Cc: cristian.dumitrescu@intel.com
> Cc: Kevin Traynor <ktraynor@redhat.com>
> 
> Not exactly clear why compiler complains about, compiler can't know the
> bounds of the memory we try to memset here.
> But adding a size check seems logic thing to do also fixes the compiler
> warning.

Applied, thanks




  reply	other threads:[~2021-05-18  8:55 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-17 15:57 Ferruh Yigit
2021-05-18  8:55 ` Thomas Monjalon [this message]
2021-05-18  9:29   ` Kevin Traynor

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=16891120.zO6uBrY9Ry@thomas \
    --to=thomas@monjalon.net \
    --cc=cristian.dumitrescu@intel.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --cc=ktraynor@redhat.com \
    --cc=pablo.de.lara.guarch@intel.com \
    --cc=stable@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).