From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id 7905328FD for ; Thu, 7 Apr 2016 16:06:50 +0200 (CEST) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga102.jf.intel.com with ESMTP; 07 Apr 2016 07:06:45 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.24,449,1455004800"; d="scan'208";a="682425888" Received: from irsmsx109.ger.corp.intel.com ([163.33.3.23]) by FMSMGA003.fm.intel.com with ESMTP; 07 Apr 2016 07:06:44 -0700 Received: from irsmsx108.ger.corp.intel.com ([169.254.11.13]) by IRSMSX109.ger.corp.intel.com ([169.254.13.174]) with mapi id 14.03.0248.002; Thu, 7 Apr 2016 15:06:41 +0100 From: "De Lara Guarch, Pablo" To: "Kulasek, TomaszX" , "dev@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH v2] app/test: fix array subscript is above array bounds for gcc 4.5 Thread-Index: AQHRkNZZc8INeFFGk0iqw1vZoHDpb59+i5jg Date: Thu, 7 Apr 2016 14:06:41 +0000 Message-ID: References: <1460034450-9360-1-git-send-email-tomaszx.kulasek@intel.com> <1460037733-8284-1-git-send-email-tomaszx.kulasek@intel.com> In-Reply-To: <1460037733-8284-1-git-send-email-tomaszx.kulasek@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiOTg4ODQxZDctNTVlMy00ZjY5LTllY2YtNGYyODUzMTU4ZjgyIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE1LjkuNi42IiwiVHJ1c3RlZExhYmVsSGFzaCI6IjlnRnMrTUtxSmNDNnBZVFBpVnZSS25BVXlvNGN1R1ErZ281TGUxd3prY1E9In0= x-ctpclassification: CTP_IC x-originating-ip: [163.33.239.181] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH v2] app/test: fix array subscript is above array bounds for gcc 4.5 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Apr 2016 14:06:50 -0000 > -----Original Message----- > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Tomasz Kulasek > Sent: Thursday, April 07, 2016 3:02 PM > To: dev@dpdk.org > Subject: [dpdk-dev] [PATCH v2] app/test: fix array subscript is above arr= ay > bounds for gcc 4.5 >=20 > cc1: warnings being treated as errors > DPDK/app/test/test_cryptodev.c: In function > 'test_snow3g_encrypted_authenti > cation.clone.3': > DPDK/x86_64-ivshmem-linuxapp-gcc/include/rte_memcpy.h:796:14: error: > array > subscript is above array bounds > compilation terminated due to -Wfatal-errors. >=20 >=20 > ROOT OF PROBLEM: > ---------------- >=20 > In lines like: >=20 > rte_memcpy(sym_op->cipher.iv.data, iv, iv_len); >=20 > when "iv" is 64 bytes long array, and "iv_len" is "unsigned int", > compiler tries to evaluate also a code for array size larger than 255 byt= es > long and reports error "array subscript is above array bounds" in line: >=20 > rte_memcpy.h:796 >=20 > rte_mov128((uint8_t *)dst + 128, (const uint8_t *)src + 128); >=20 > caused by evaluation to: >=20 > rte_mov128((uint8_t *)sym_op->cipher.iv.data + 128, (const uint8_t *)= iv > + 128); >=20 > where "iv" is 64 bytes long buffer and "iv + 128" point out of it, gcc 4.= 5. >=20 >=20 > SOLUTION: > --------- >=20 > Using uint8_t as a size of copied block prevents to evaluate in rte_memcp= y > code for length bigger than 255, causing the problem. >=20 > v2 changes: > - added fixline >=20 > Fixes: 8bdf665fe6c0 ("app/test: add SNOW 3G") >=20 > Signed-off-by: Tomasz Kulasek Acked-by: Pablo de Lara