DPDK patches and discussions
 help / color / mirror / Atom feed
From: Pablo de Lara <pablo.de.lara.guarch@intel.com>
To: dev@dpdk.org
Subject: [dpdk-dev] [PATCH] hash: fix compilation for gcc 4.4/4.5
Date: Wed, 15 Jul 2015 13:40:42 +0100	[thread overview]
Message-ID: <1436964043-5729-2-git-send-email-pablo.de.lara.guarch@intel.com> (raw)
In-Reply-To: <1436964043-5729-1-git-send-email-pablo.de.lara.guarch@intel.com>

gcc 4.4 and 4.5 throws following error:
rte_cuckoo_hash.c:145: error: flexible array member in otherwise empty struct.

This is due to empty length in flexible array, which has been changed to use
size 0 in the declaration of the array.

Fixes: 48a399119619 ("hash: replace with cuckoo hash implementation")

Reported-by: Olga Shern <olgas@mellanox.com>
Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
---
 lib/librte_hash/rte_cuckoo_hash.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/librte_hash/rte_cuckoo_hash.c b/lib/librte_hash/rte_cuckoo_hash.c
index 39cafb7..80cb126 100644
--- a/lib/librte_hash/rte_cuckoo_hash.c
+++ b/lib/librte_hash/rte_cuckoo_hash.c
@@ -142,7 +142,7 @@ struct rte_hash_key {
 		void *pdata;
 	};
 	/* Variable key size */
-	char key[];
+	char key[0];
 } __attribute__((aligned(KEY_ALIGNMENT)));
 
 /** Bucket structure */
-- 
2.4.2

  reply	other threads:[~2015-07-15 12:41 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-15 12:40 [dpdk-dev] [PATCH] hash: fix array out of bounds in hash library Pablo de Lara
2015-07-15 12:40 ` Pablo de Lara [this message]
2015-07-16 14:55   ` [dpdk-dev] [PATCH] hash: fix compilation for gcc 4.4/4.5 Thomas Monjalon
2015-07-15 12:40 ` [dpdk-dev] [PATCH] hash: fix library compilation for CPU with no SSE4.1 Pablo de Lara
2015-07-16 14:55 ` [dpdk-dev] [PATCH] hash: fix array out of bounds in hash library Thomas Monjalon

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=1436964043-5729-2-git-send-email-pablo.de.lara.guarch@intel.com \
    --to=pablo.de.lara.guarch@intel.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).