From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id A831DA0A02; Mon, 17 May 2021 17:57:46 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6A2D04014E; Mon, 17 May 2021 17:57:46 +0200 (CEST) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by mails.dpdk.org (Postfix) with ESMTP id B364340041; Mon, 17 May 2021 17:57:44 +0200 (CEST) IronPort-SDR: 5JU6STrEzslmMuLUv/NWYWBkLk7owJ6u5BNMpITFlZLBONXHxdjpB35yJkOrVp6utao79aqsNR XDNLxmEeUEJA== X-IronPort-AV: E=McAfee;i="6200,9189,9987"; a="200187476" X-IronPort-AV: E=Sophos;i="5.82,307,1613462400"; d="scan'208";a="200187476" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 May 2021 08:57:43 -0700 IronPort-SDR: D+3l6Dx70JN7pkFtpRxHlN08+BghJj0AnEabGDJJpZC+LdLtItE21yXEBN+GCN9lx8ei6b3W90 B7Lngo9o9AyQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.82,307,1613462400"; d="scan'208";a="472854952" Received: from silpixa00399752.ir.intel.com (HELO silpixa00399752.ger.corp.intel.com) ([10.237.222.27]) by fmsmga002.fm.intel.com with ESMTP; 17 May 2021 08:57:42 -0700 From: Ferruh Yigit To: Cristian Dumitrescu , Pablo de Lara Guarch Cc: Ferruh Yigit , dev@dpdk.org, stable@dpdk.org, Kevin Traynor Date: Mon, 17 May 2021 16:57:39 +0100 Message-Id: <20210517155739.800371-1-ferruh.yigit@intel.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH] test/table: fix build with GCC 11 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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 --- Cc: cristian.dumitrescu@intel.com Cc: Kevin Traynor 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. --- app/test/test_table_tables.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/test/test_table_tables.c b/app/test/test_table_tables.c index 1aa269f95d27..4ff6ab16aaaa 100644 --- a/app/test/test_table_tables.c +++ b/app/test/test_table_tables.c @@ -28,7 +28,8 @@ table_test table_tests[] = { APP_METADATA_OFFSET(0)); \ key = RTE_MBUF_METADATA_UINT8_PTR(mbuf, \ APP_METADATA_OFFSET(32)); \ - memset(key, 0, 32); \ + if (mbuf->priv_size + mbuf->buf_len >= 64) \ + memset(key, 0, 32); \ k32 = (uint32_t *) key; \ k32[0] = (value); \ *signature = pipeline_test_hash(key, NULL, 0, 0); \ -- 2.31.1